Author: trong.tran
Date: 2010-11-10 05:50:09 -0500 (Wed, 10 Nov 2010)
New Revision: 5003
Modified:
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/default-router.xml
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/web.xml
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
- some small bug fixes
- Add protection for /groups and /users path
Modified:
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
===================================================================
---
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2010-11-10
07:40:19 UTC (rev 5002)
+++
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2010-11-10
10:50:09 UTC (rev 5003)
@@ -58,7 +58,7 @@
{
}
- public PageNavigation getCurrentUserNavigation() throws Exception
+ private PageNavigation getCurrentUserNavigation() throws Exception
{
String remoteUser = Util.getPortalRequestContext().getRemoteUser();
return getPageNavigation(PortalConfig.USER_TYPE + "::" + remoteUser);
Modified:
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
===================================================================
---
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2010-11-10
07:40:19 UTC (rev 5002)
+++
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2010-11-10
10:50:09 UTC (rev 5003)
@@ -26,6 +26,7 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
@@ -57,11 +58,15 @@
public PageNavigation getCurrentPortalNavigation(boolean isFiltered) throws Exception
{
PortalRequestContext pcontext = Util.getPortalRequestContext();
+ UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
String remoteUser = pcontext.getRemoteUser();
- List<PageNavigation> allNavigations =
Util.getUIPortalApplication().getNavigations();
+
+ String portalName = uiPortalApp.getPortalName();
+
+ List<PageNavigation> allNavigations = uiPortalApp.getNavigations();
for (PageNavigation nav : allNavigations)
{
- if (nav.getOwnerType().equals(PortalConfig.PORTAL_TYPE))
+ if (nav.getOwnerType().equals(PortalConfig.PORTAL_TYPE) &&
nav.getOwnerId().equals(portalName))
{
if (isFiltered)
{
Modified:
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
===================================================================
---
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl 2010-11-10
07:40:19 UTC (rev 5002)
+++
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl 2010-11-10
10:50:09 UTC (rev 5003)
@@ -48,7 +48,7 @@
</div>
""";
if(isCurrent) {
- renderCurrentPortal(nodeURL);
+ renderCurrentPortal(nodeURL, pcontext);
}
print """
</div>
@@ -60,7 +60,7 @@
""";
}
- void renderCurrentPortal(ControllerURL nodeURL) {
+ void renderCurrentPortal(ControllerURL nodeURL, PortalRequestContext pcontext) {
navigation = uicomponent.getCurrentPortalNavigation(true);
nodes = navigation.getNodes();
print """
@@ -68,7 +68,7 @@
<div class="SubBlock">
""";
for(int i = 0; i < nodes.size(); i++) {
- renderPageNode(nodeURL, nodes.get(i), i%2 == 0);
+ renderPageNode(nodeURL, nodes.get(i), pcontext);
}
print """
</div>
@@ -76,7 +76,7 @@
""";
}
- void renderPageNode(ControllerURL nodeURL, PageNode node, boolean flag) {
+ void renderPageNode(ControllerURL nodeURL, PageNode node, PortalRequestContext pcontext)
{
PageNode selectedNode = uicomponent.getSelectedPageNode();
String tabStyleNavigation = "";
if(selectedNode != null && node.getUri() == selectedNode.getUri()) {
@@ -86,7 +86,7 @@
boolean hasChild = (node.getChildren() != null && node.getChildren().size()
> 0);
String clazz = "";
if(hasChild) clazz = "ArrowIcon";
- String href = nodeURL.setResource(new NavigationResource("portal", null,
node)).toString();
+ String href = nodeURL.setResource(new NavigationResource(PortalConfig.PORTAL_TYPE,
pcontext.getPortalOwner(), node)).toString();
String icon = node.getIcon();
if(icon == null) icon = "DefaultPageIcon";
boolean toolong = (node.resolvedLabel.length() > 60);
@@ -114,7 +114,7 @@
<div class="SubBlock">
""" ;
for(int j = 0; j < node.getChildren().size(); j++) {
- renderPageNode(nodeURL, node.getChildren().get(j), j%2 == 0);
+ renderPageNode(nodeURL, node.getChildren().get(j));
}
print """
</div>
Modified:
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/default-router.xml
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/default-router.xml 2010-11-10
07:40:19 UTC (rev 5002)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/default-router.xml 2010-11-10
10:50:09 UTC (rev 5003)
@@ -29,7 +29,6 @@
<!-- The group access -->
<route path="/groups">
- <route-param name="gtn:access" value="private"/>
<route path="/{gtn:sitename}{gtn:path}">
<route-param name="gtn:sitetype" value="group"/>
<path-param name="gtn:path" pattern=".*"
encoding="preserve-path"/>
@@ -38,7 +37,6 @@
<!-- The user access -->
<route path="/users/{gtn:sitename}{gtn:path}">
- <route-param name="gtn:access" value="private"/>
<route-param name="gtn:sitetype" value="user"/>
<path-param name="gtn:path" pattern=".*"
encoding="preserve-path"/>
</route>
Modified:
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml 2010-11-10
07:40:19 UTC (rev 5002)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml 2010-11-10
10:50:09 UTC (rev 5003)
@@ -26,7 +26,7 @@
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
<portal-name>@owner@</portal-name>
<locale>en</locale>
- <access-permissions>Everyone</access-permissions>
+ <access-permissions>*:@owner@</access-permissions>
<edit-permission>manager:@owner@</edit-permission>
<properties>
<entry key="sessionAlive">onDemand</entry>
Modified: portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/web.xml
===================================================================
--- portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/web.xml 2010-11-10
07:40:19 UTC (rev 5002)
+++ portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/web.xml 2010-11-10
10:50:09 UTC (rev 5003)
@@ -322,6 +322,8 @@
<web-resource-collection>
<web-resource-name>user authentication</web-resource-name>
<url-pattern>/private/*</url-pattern>
+ <url-pattern>/groups/*</url-pattern>
+ <url-pattern>/users/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-11-10
07:40:19 UTC (rev 5002)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-11-10
10:50:09 UTC (rev 5003)
@@ -416,14 +416,9 @@
return siteName;
}
- /**
- * @deprecated use {@link #getSiteName()} instead
- *
- * @return the current site name
- */
public String getPortalOwner()
{
- return getSiteName();
+ return ((UIPortalApplication)uiApplication_).getPortalName();
}
public String getNodePath()
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2010-11-10
07:40:19 UTC (rev 5002)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2010-11-10
10:50:09 UTC (rev 5003)
@@ -121,12 +121,18 @@
PortalApplication app =
controllerContext.getController().getApplication(PortalApplication.PORTAL_APPLICATION_ID);
PortalRequestContext context = new PortalRequestContext(app, controllerContext,
requestSiteType, requestSiteName, requestPath, access);
WebuiRequestContext.setCurrentInstance(context);
+ UIApplication uiApp = app.getStateManager().restoreUIRootComponent(context);
+
+ if (uiApp == null)
+ {
+ return;
+ }
+
List<ApplicationLifecycle> lifecycles = app.getApplicationLifecycle();
try
{
for (ApplicationLifecycle lifecycle : lifecycles)
lifecycle.onStartRequest(app, context);
- UIApplication uiApp = app.getStateManager().restoreUIRootComponent(context);
if (context.getUIApplication() != uiApp)
context.setUIApplication(uiApp);
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2010-11-10
07:40:19 UTC (rev 5002)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2010-11-10
10:50:09 UTC (rev 5003)
@@ -43,8 +43,6 @@
import java.util.ArrayList;
import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Just a class that contains the Page related action listeners
*
@@ -59,7 +57,7 @@
UserACL usrACL = uiPortalApp.getApplicationComponent(UserACL.class);
PortalConfig pConfig = storage.getPortalConfig(siteType, siteName);
- if (!usrACL.hasPermission(pConfig))
+ if (pConfig == null || !usrACL.hasPermission(pConfig))
{
return null;
}
@@ -72,9 +70,13 @@
PortalDataMapper.toUIPortal(uiPortal, pConfig);
- PageNavigation nav = storage.getPageNavigation(siteType, siteName);
+ PageNavigation nav = uiPortalApp.getNavigation(siteType, siteName);
+ if (nav == null)
+ {
+ nav = storage.getPageNavigation(siteType, siteName);
+ uiPortalApp.getUserPortalConfig().addNavigation(nav);
+ }
uiPortal.setNavigation(nav);
- uiPortalApp.getUserPortalConfig().addNavigation(nav);
return uiPortal;
}
@@ -97,10 +99,10 @@
UIPortalApplication uiPortalApp = event.getSource();
UIPortal uiPortal = uiPortalApp.getCurrentSite();
- PageNavigation currentNav = uiPortal.getNavigation();
-
- if(currentNav.getOwnerType().equals(siteType) &&
currentNav.getOwnerId().equals(siteName))
+
+ if (uiPortal != null && uiPortal.getOwnerType().equals(siteType)
&& uiPortal.getOwner().equals(siteName))
{
+ PageNavigation currentNav = uiPortal.getNavigation();
PageNode newPageNode = Util.findBestMatchNode(currentNav, nodePath);
if (newPageNode == null)
{
@@ -111,8 +113,8 @@
uiPortal.setSelectedNode(null);
return;
}
-
- if(uiPortal.getSelectedNode() == null ||
!uiPortal.getSelectedNode().getUri().equals(newPageNode.getUri()))
+
+ if (uiPortal.getSelectedNode() == null ||
!uiPortal.getSelectedNode().getUri().equals(newPageNode.getUri()))
{
uiPortal.setSelectedNode(newPageNode);
}
@@ -125,12 +127,11 @@
if(uiPortal == null)
{
uiPortal = buildUIPortal(siteType, siteName, uiPortalApp,
userPortalConfig);
+ uiPortalApp.setCurrentSite(uiPortal);
if(uiPortal == null)
{
- uiPortalApp.setCurrentSite(null);
return;
}
- uiPortalApp.setCurrentSite(uiPortal);
uiPortalApp.putCachedUIPortal(uiPortal);
}
else
@@ -145,7 +146,12 @@
//Update layout-related data on UserPortalConfig
userPortalConfig.setPortal(associatedPortalConfig);
}
-
+
+ if (uiPortal.getOwnerType().equals(PortalConfig.PORTAL_TYPE))
+ {
+ uiPortalApp.setPortalName(uiPortal.getOwner());
+ }
+
PageNavigation targetNav = uiPortalApp.getNavigation(siteType, siteName);
if (targetNav == null)
{
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2010-11-10
07:40:19 UTC (rev 5002)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2010-11-10
10:50:09 UTC (rev 5003)
@@ -132,7 +132,7 @@
{
String[] pathNodes = splitPath(nodePath);
- if (pathNodes.length > 0)
+ if (nav != null && pathNodes.length > 0)
{
int deepMatchNumber = 0;
PageNode currentNode = nav.getNode(pathNodes[deepMatchNumber++]);
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-11-10
07:40:19 UTC (rev 5002)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-11-10
10:50:09 UTC (rev 5003)
@@ -771,7 +771,7 @@
*/
public void setPortalName(String portalName)
{
- this.portalName = portalName;
+ this.userPortalConfig_.setPortalName(portalName);
}
/**
@@ -779,7 +779,7 @@
*/
public String getPortalName()
{
- return portalName;
+ return this.userPortalConfig_.getPortalName();
}
private class UIPortalKey