Author: mwringe
Date: 2011-09-26 15:11:35 -0400 (Mon, 26 Sep 2011)
New Revision: 7505
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java
Log:
GTNPORTAL-2126: Update LegacyRequestHandler to handle situations where the current user
doesn't have permission to access the portal or the portal doesn't exist.
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java 2011-09-26
11:29:58 UTC (rev 7504)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java 2011-09-26
19:11:35 UTC (rev 7505)
@@ -19,8 +19,11 @@
package org.exoplatform.portal.application;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.mop.user.UserNode;
@@ -91,6 +94,29 @@
// Resolve the user node
UserPortalConfig cfg = userPortalService.getUserPortalConfig(requestSiteName,
context.getRequest().getRemoteUser(), userPortalContext);
+
+ if (cfg == null)
+ {
+ HttpServletRequest req = context.getRequest();
+ DataStorage storage =
(DataStorage)PortalContainer.getComponent(DataStorage.class);
+ PortalConfig persistentPortalConfig =
storage.getPortalConfig(requestSiteName);
+ if (persistentPortalConfig == null)
+ {
+ return false;
+ }
+ if(req.getRemoteUser() == null)
+ {
+ String doLoginPath = req.getContextPath() + "/" +
"dologin" + "?initialURI=" + req.getRequestURI();
+ context.getResponse().sendRedirect(doLoginPath);
+ }
+ else
+ {
+ context.getResponse().sendError(HttpServletResponse.SC_FORBIDDEN);
+ }
+ return true;
+ }
+
+
UserPortal userPortal = cfg.getUserPortal();
UserNodeFilterConfig.Builder builder =
UserNodeFilterConfig.builder().withAuthMode(UserNodeFilterConfig.AUTH_READ);
UserNode userNode = userPortal.resolvePath(builder.build(), requestPath);
Show replies by date