Author: ndkhoiits
Date: 2011-08-31 05:41:08 -0400 (Wed, 31 Aug 2011)
New Revision: 7260
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
Log:
GTNPORTAL-2040 Cannot access portal if the permission is not 'public'
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-08-31
06:57:26 UTC (rev 7259)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-08-31
09:41:08 UTC (rev 7260)
@@ -101,6 +101,8 @@
final static public String REQUEST_METADATA =
"portal:requestMetadata".intern();
final static private String LAST_PORTAL_NAME = "prc.lastPortalName";
+
+ final static private String DO_LOGIN_PATTERN = "dologin";
/** The path decoded from the request. */
private final String nodePath_;
@@ -331,6 +333,12 @@
appRes_ = getApplication().getResourceBundle(getLocale());
}
+ public void requestAuthenticationLogin() throws Exception
+ {
+ String doLoginPath = request_.getContextPath() + "/" + DO_LOGIN_PATTERN +
"?initialURI=" + request_.getRequestURI();
+ sendRedirect(doLoginPath);
+ }
+
public String getTitle() throws Exception
{
String title = (String)request_.getAttribute(REQUEST_TITLE);
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2011-08-31
06:57:26 UTC (rev 7259)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2011-08-31
09:41:08 UTC (rev 7260)
@@ -21,7 +21,10 @@
import org.exoplatform.commons.utils.I18N;
import org.exoplatform.commons.utils.Safe;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.StaleModelException;
+import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.web.ControllerContext;
@@ -130,7 +133,20 @@
PortalRequestContext context = new PortalRequestContext(app, controllerContext,
requestSiteType, requestSiteName, requestPath, requestLocale);
if (context.getUserPortalConfig() == null)
{
- context.sendError(HttpServletResponse.SC_NOT_FOUND);
+ DataStorage storage =
(DataStorage)PortalContainer.getComponent(DataStorage.class);
+ PortalConfig persistentPortalConfig = storage.getPortalConfig(requestSiteType,
requestSiteName);
+ if (persistentPortalConfig == null)
+ {
+ context.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ else if(req.getRemoteUser() == null)
+ {
+ context.requestAuthenticationLogin();
+ }
+ else
+ {
+ context.sendError(HttpServletResponse.SC_FORBIDDEN);
+ }
}
else
{
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-08-31
06:57:26 UTC (rev 7259)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-08-31
09:41:08 UTC (rev 7260)
@@ -87,8 +87,7 @@
if (targetNode != null)
{
uiPortalApp.setLastRequestURI(null);
- String doLoginPath = pcontext.getRequest().getContextPath() +
"/dologin?initialURI=" + pcontext.getRequestURI();
- pcontext.sendRedirect(doLoginPath);
+ pcontext.requestAuthenticationLogin();
return;
}
}