Author: julien(a)jboss.com
Date: 2006-12-20 15:28:24 -0500 (Wed, 20 Dec 2006)
New Revision: 5913
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalObjectCommand.java
trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
Log:
slightly different approach for the dashboard state in portal objects : the dashboard is a
property of an object (context) and implies the navigation permission implicitely.
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2006-12-20
19:27:01 UTC (rev 5912)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2006-12-20
20:28:24 UTC (rev 5913)
@@ -31,7 +31,6 @@
import org.jboss.portal.security.PortalPermissionCollection;
import org.jboss.portal.security.PortalSecurityException;
import org.jboss.portal.security.RoleSecurityBinding;
-import org.jboss.portal.security.SecurityConstants;
import org.jboss.portal.security.spi.provider.AuthorizationDomain;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
import org.jboss.portal.security.spi.provider.PermissionFactory;
@@ -123,14 +122,10 @@
ObjectNode on = getObjectNode(id);
if (on != null)
{
- for (Iterator i = on.getBindings().iterator(); i.hasNext();)
+ RoleSecurityBinding binding = on.getBinding(roleName);
+ if (binding != null)
{
- RoleSecurityBinding binding = (RoleSecurityBinding)i.next();
- String constraintRoleName = binding.getRoleName();
- if (constraintRoleName.equals(roleName) ||
SecurityConstants.UNCHECKED_ROLE_NAME.equals(constraintRoleName))
- {
- return createPermission(uri, binding.getActions());
- }
+ return createPermission(uri, binding.getActions());
}
}
return null;
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java 2006-12-20
19:27:01 UTC (rev 5912)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java 2006-12-20
20:28:24 UTC (rev 5913)
@@ -105,4 +105,10 @@
clone.setDeclaredPropertyMap(new HashMap(getDeclaredPropertyMap()));
return clone;
}
+
+ public boolean isDashboard()
+ {
+ Object b = declaredPropertyMap.get("dashboard");
+ return "true".equals(b);
+ }
}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java 2006-12-20
19:27:01 UTC (rev 5912)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java 2006-12-20
20:28:24 UTC (rev 5913)
@@ -34,6 +34,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -285,9 +286,49 @@
for (Iterator i = securityConstraints.values().iterator(); i.hasNext();)
{
ObjectNodeSecurityConstraint onsc = (ObjectNodeSecurityConstraint)i.next();
- RoleSecurityBinding sc = new RoleSecurityBinding(onsc.getActions(),
onsc.getRole());
+ Set actions = onsc.getActions();
+ RoleSecurityBinding sc = new RoleSecurityBinding(actions, onsc.getRole());
bindings.add(sc);
}
return bindings;
}
+
+ public RoleSecurityBinding getBinding(String roleName)
+ {
+ Set actions = null;
+ for (Iterator i = securityConstraints.values().iterator(); i.hasNext();)
+ {
+ ObjectNodeSecurityConstraint onsc = (ObjectNodeSecurityConstraint)i.next();
+ if (onsc.getRole().equals(roleName))
+ {
+ actions = onsc.getActions();
+ break;
+ }
+ }
+
+ //
+ String dashboard = object.getDeclaredProperty("dashboard");
+ if ("true".equals(dashboard))
+ {
+ if (actions == null)
+ {
+ actions = Collections.singleton("dashboard");
+ }
+ else
+ {
+ actions = new HashSet(actions);
+ actions.add("dashboard");
+ }
+ }
+
+ // Add the dashboard permission
+ if (actions != null)
+ {
+ return new RoleSecurityBinding(actions, roleName);
+ }
+ else
+ {
+ return null;
+ }
+ }
}
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2006-12-20
19:27:01 UTC (rev 5912)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2006-12-20
20:28:24 UTC (rev 5913)
@@ -64,6 +64,7 @@
protected Collection collection;
protected Map properties;
protected PortalObjectIdImpl id;
+ protected Boolean dashboard;
public PortalObjectImpl()
{
@@ -390,4 +391,22 @@
}
return getChild(portalName);
}
+
+ public boolean isDashboard()
+ {
+ if (dashboard == null)
+ {
+ ObjectNode parent = objectNode.getParent();
+ if (parent == null)
+ {
+ dashboard = Boolean.FALSE;
+ }
+ else
+ {
+ PortalObjectImpl parentObject = parent.getObject();
+ dashboard = Boolean.valueOf(parentObject.isDashboard());
+ }
+ }
+ return dashboard.booleanValue();
+ }
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2006-12-20
19:27:01 UTC (rev 5912)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2006-12-20
20:28:24 UTC (rev 5913)
@@ -166,4 +166,11 @@
* @return a map of the properties declared by the object
*/
Map getDeclaredProperties();
+
+ /**
+ * Return true if the portal object is part of a dashboard.
+ *
+ * @return if it is a dashboard
+ */
+ boolean isDashboard();
}
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalObjectCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalObjectCommand.java 2006-12-20
19:27:01 UTC (rev 5912)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalObjectCommand.java 2006-12-20
20:28:24 UTC (rev 5913)
@@ -101,6 +101,11 @@
return target;
}
+ /**
+ * Return true if the command is in a dashboard context.
+ *
+ * @return
+ */
public boolean isDashboard()
{
if (dashboard == null)
Modified: trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2006-12-20
19:27:01 UTC (rev 5912)
+++ trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2006-12-20
20:28:24 UTC (rev 5913)
@@ -193,23 +193,22 @@
<name>layout.strategyId</name>
<value>maximizedRegion</value>
</property>
+ <!--
+ | Set the dashboard property
+ -->
+ <property>
+ <name>dashboard</name>
+ <value>true</value>
+ </property>
</properties>
- <supported-modes>
- <mode>view</mode>
- <mode>edit</mode>
- <mode>help</mode>
- </supported-modes>
- <supported-window-states>
- <window-state>normal</window-state>
- <window-state>minimized</window-state>
- <window-state>maximized</window-state>
- </supported-window-states>
+<!--
<security-constraint>
<policy-permission>
<role-name>Authenticated</role-name>
- <action-name>dashboard</action-name>
+ <action-name>view</action-name>
</policy-permission>
</security-constraint>
+-->
</context>
</deployment>
<deployment>
Show replies by date