[jboss-svn-commits] JBoss Portal SVN: r5399 - in trunk/core/src/main/org/jboss/portal/core: aspects/controller controller/command
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Oct 10 10:02:23 EDT 2006
Author: julien at jboss.com
Date: 2006-10-10 10:02:18 -0400 (Tue, 10 Oct 2006)
New Revision: 5399
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java
trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java
Log:
- added dashboad/pages link in top nav
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-10-10 13:49:02 UTC (rev 5398)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-10-10 14:02:18 UTC (rev 5399)
@@ -23,6 +23,7 @@
import org.jboss.portal.core.controller.ControllerInterceptor;
import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ViewDashboardCommand;
import org.jboss.portal.core.controller.command.RenderPageCommand;
import org.jboss.portal.core.controller.command.SignOutCommand;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -128,7 +129,6 @@
StringBuffer sb = new StringBuffer();
if(rpc.getControllerContext().getServerInvocation().getServerContext().getClientRequest().getRemoteUser() == null)
{
- Page page = rpc.getPage();
URLContext ctx = rpc.getControllerContext().getServerInvocation().getServerContext().getURLContext();
ctx = URLContext.newInstance(ctx.getSecure(), true);
String loginURL = rpc.getControllerContext().encodeURL(rpc, ctx, null);
@@ -136,6 +136,22 @@
}
else
{
+ boolean dashboard = rpc.isDashboard();
+ String pageURL = null;
+ String label = null;
+ if (dashboard)
+ {
+ RenderPageCommand _rpc = new RenderPageCommand("default.default");
+ pageURL = rpc.getControllerContext().encodeURL(_rpc, null, null);
+ label = "Pages";
+ }
+ else
+ {
+ ViewDashboardCommand vdc = new ViewDashboardCommand("dashboard");
+ pageURL = rpc.getControllerContext().encodeURL(vdc, null, null);
+ label = "Dashboard";
+ }
+
// TODO: add checks for shared/private pages
SignOutCommand cmd = new SignOutCommand();
String logoutURL = rpc.getControllerContext().encodeURL(cmd, null, null);
@@ -153,6 +169,8 @@
}
sb.append("<br/><br/>");
+ sb.append("<a href=\"").append(pageURL).append("\">").append(label).append("</a>");
+ sb.append(" | ");
sb.append("<a href=\"#\">Add Content</a>");
sb.append(" | ");
sb.append("<a href=\"#\">Edit Page</a>");
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java 2006-10-10 13:49:02 UTC (rev 5398)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/PortalObjectCommand.java 2006-10-10 14:02:18 UTC (rev 5399)
@@ -30,6 +30,7 @@
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.ResourceNotFoundException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.security.PortalSecurityException;
/**
@@ -43,6 +44,8 @@
protected PortalObject target;
+ private Boolean dashboard;
+
protected PortalObjectCommand(String targetId)
{
if (targetId == null)
@@ -95,4 +98,23 @@
{
return target;
}
+
+ public boolean isDashboard()
+ {
+ if (dashboard == null)
+ {
+ try
+ {
+ PortalAuthorizationManagerFactory pamf = getControllerContext().getController().getPortalAuthorizationManagerFactory();
+ PortalAuthorizationManager pam = pamf.getManager();
+ PortalObjectPermission perm = new PortalObjectPermission(targetId, PortalObjectPermission.DASHBOARD_MASK);
+ dashboard = Boolean.valueOf(pam.checkPermission(perm));
+ }
+ catch (PortalSecurityException e)
+ {
+ dashboard = Boolean.FALSE;
+ }
+ }
+ return dashboard.booleanValue();
+ }
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java 2006-10-10 13:49:02 UTC (rev 5398)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/WindowCommand.java 2006-10-10 14:02:18 UTC (rev 5399)
@@ -124,28 +124,6 @@
}
}
- private Boolean dashboard;
-
- protected boolean isDashboard()
- {
- if (dashboard == null)
- {
- try
- {
- PortalAuthorizationManagerFactory pamf = getControllerContext().getController().getPortalAuthorizationManagerFactory();
- PortalAuthorizationManager pam = pamf.getManager();
- PortalObjectPermission perm = new PortalObjectPermission(targetId, PortalObjectPermission.DASHBOARD_MASK);
- dashboard = Boolean.valueOf(pam.checkPermission(perm));
- }
- catch (PortalSecurityException e)
- {
- dashboard = Boolean.FALSE;
- }
- }
- return dashboard.booleanValue();
- }
-
-
/**
* We only enforce security at instance and component level.
*
More information about the jboss-svn-commits
mailing list