portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r219551 - in /portals/jetspeed-2/trunk: components/page-manager/src/java/org/apache/jetspeed/page/impl/ components/page-manager/src/test/org/apache/jetspeed/page/ jetspeed-api/src/java/org/apache/jetspeed/page/
Date Mon, 18 Jul 2005 18:49:17 GMT
Author: rwatler
Date: Mon Jul 18 11:49:02 2005
New Revision: 219551

URL: http://svn.apache.org/viewcvs?rev=219551&view=rev
Log:
- add/implement newSecurityConstraints() and newSecurityConstraint() API to page manager for
building pages/folders



Modified:
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java?rev=219551&r1=219550&r2=219551&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/AbstractPageManager.java
Mon Jul 18 11:49:02 2005
@@ -23,6 +23,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.idgenerator.IdGenerator;
 import org.apache.jetspeed.om.common.SecuredResource;
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.folder.MenuDefinition;
 import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
@@ -43,6 +45,8 @@
 import org.apache.jetspeed.om.page.psml.LinkImpl;
 import org.apache.jetspeed.om.page.psml.PageImpl;
 import org.apache.jetspeed.om.page.psml.PropertyImpl;
+import org.apache.jetspeed.om.page.psml.SecurityConstraintImpl;
+import org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl;
 import org.apache.jetspeed.page.PageManager;
 import org.apache.jetspeed.page.PageManagerEventListener;
 import org.apache.jetspeed.page.document.Node;
@@ -68,6 +72,8 @@
     protected Class menuIncludeDefinitionClass = MenuIncludeDefinitionImpl.class;
     protected Class menuOptionsDefinitionClass = MenuOptionsDefinitionImpl.class;
     protected Class menuSeparatorDefinitionClass = MenuSeparatorDefinitionImpl.class;
+    protected Class securityConstraintsClass = SecurityConstraintsImpl.class;
+    protected Class securityConstraintClass = SecurityConstraintImpl.class;
 
     protected IdGenerator generator = null;
 
@@ -350,6 +356,44 @@
         catch (ClassCastException e)
         {
             String message = "Failed to create menu separator definition object for " + this.menuSeparatorDefinitionClass;
+            log.error(message, e);
+        }
+        return null;
+    }
+
+    /**
+     * newSecurityConstraints - creates a new empty security constraints definition
+     *
+     * @return a newly created SecurityConstraints object
+     */
+    public SecurityConstraints newSecurityConstraints()
+    {
+        try
+        {
+            return (SecurityConstraints)createObject(this.securityConstraintsClass);
+        }
+        catch (ClassCastException e)
+        {
+            String message = "Failed to create security constraints definition object for
" + this.securityConstraintsClass;
+            log.error(message, e);
+        }
+        return null;
+    }
+
+    /**
+     * newSecurityConstraint - creates a new security constraint definition
+     *
+     * @return a newly created SecurityConstraint object
+     */
+    public SecurityConstraint newSecurityConstraint()
+    {
+        try
+        {
+            return (SecurityConstraint)createObject(this.securityConstraintClass);
+        }
+        catch (ClassCastException e)
+        {
+            String message = "Failed to create security constraint definition object for
" + this.securityConstraintClass;
             log.error(message, e);
         }
         return null;

Modified: portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java?rev=219551&r1=219550&r2=219551&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
Mon Jul 18 11:49:02 2005
@@ -32,6 +32,8 @@
 import org.apache.jetspeed.idgenerator.IdGenerator;
 import org.apache.jetspeed.idgenerator.JetspeedIdGenerator;
 import org.apache.jetspeed.om.common.GenericMetadata;
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.folder.FolderMetaData;
 import org.apache.jetspeed.om.folder.FolderNotFoundException;
@@ -289,6 +291,20 @@
         p.setValue("0");
         f.addProperty(p);
         root.getFragments().add(f);
+
+        SecurityConstraints constraints = pageManager.newSecurityConstraints();
+        constraints.setOwner("new-user");
+        List constraintsList = new ArrayList(1);
+        SecurityConstraint constraint = pageManager.newSecurityConstraint();
+        constraint.setUsers("user10,user11");
+        constraint.setRoles("*");
+        constraint.setPermissions(page.EDIT_ACTION + "," + page.VIEW_ACTION);
+        constraintsList.add(constraint);
+        constraints.setSecurityConstraints(constraintsList);
+        List constraintsRefsList = new ArrayList(1);
+        constraintsRefsList.add("public-view");
+        constraints.setSecurityConstraintsRefs(constraintsRefsList);
+        page.setSecurityConstraints(constraints);
 
         try
         {

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java?rev=219551&r1=219550&r2=219551&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
Mon Jul 18 11:49:02 2005
@@ -17,6 +17,8 @@
 package org.apache.jetspeed.page;
 
 import org.apache.jetspeed.exception.JetspeedException;
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.folder.FolderNotFoundException;
 import org.apache.jetspeed.om.folder.InvalidFolderException;
@@ -134,6 +136,20 @@
      * @return a newly created MenuSeparatorDefinition object
      */
     public MenuSeparatorDefinition newMenuSeparatorDefinition();
+
+    /**
+     * newSecurityConstraints - creates a new empty security constraints definition
+     *
+     * @return a newly created SecurityConstraints object
+     */
+    public SecurityConstraints newSecurityConstraints();
+
+    /**
+     * newSecurityConstraint - creates a new security constraint definition
+     *
+     * @return a newly created SecurityConstraint object
+     */
+    public SecurityConstraint newSecurityConstraint();
 
    /**
     * 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message