portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlest...@apache.org
Subject svn commit: r373218 [2/2] - in /portals/jetspeed-2/trunk: applications/j2-admin/src/java/org/apache/jetspeed/portlets/customizer/ applications/j2-admin/src/java/org/apache/jetspeed/portlets/selector/ commons/src/java/org/apache/jetspeed/security/ compo...
Date Sat, 28 Jan 2006 19:09:59 GMT
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/psml/AbstractNode.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/psml/AbstractNode.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/psml/AbstractNode.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/psml/AbstractNode.java
Sat Jan 28 11:09:33 2006
@@ -19,9 +19,8 @@
 import java.util.List;
 import java.util.Locale;
 
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.om.common.GenericMetadata;
-import org.apache.jetspeed.om.common.LocalizedField;
-import org.apache.jetspeed.om.common.SecuredResource;
 import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.page.PageMetadataImpl;
 import org.apache.jetspeed.om.page.PageSecurity;
@@ -122,7 +121,7 @@
      * 
      * @see org.apache.jetspeed.page.document.Node#getTitle(java.util.Locale)
      * @param locale
-     * @return
+     * @return title in specified locale
      */
     public String getTitle(Locale locale)
     {
@@ -142,7 +141,7 @@
      * 
      * @see org.apache.jetspeed.page.document.Node#getShortTitle(java.util.Locale)
      * @param locale
-     * @return
+     * @return short title in specified locale
      */
     public String getShortTitle( Locale locale )
     {
@@ -179,7 +178,7 @@
         // check access
         if ((parent != null) && checkAccess)
         {
-            parent.checkAccess(SecuredResource.VIEW_ACTION);
+            parent.checkAccess(JetspeedActions.VIEW);
         }
         return parent;
     }
@@ -190,7 +189,7 @@
      * </p>
      * 
      * @see org.apache.jetspeed.page.document.Node#getParent()
-     * @return
+     * @return parent node
      */
     public Node getParent()
     {
@@ -205,7 +204,7 @@
      * setParent
      * </p>
      * 
-     * @see org.apache.jetspeed.page.document.Node#setParent(org.apache.jetspeed.om.folder.Folder)
+     * @see org.apache.jetspeed.page.document.Node#setParent(Node)
      * @param parent
      */
     public void setParent( Node parent )
@@ -219,7 +218,7 @@
      * </p>
      *
      * @see org.apache.jetspeed.page.document.Node#getName()
-     * @return
+     * @return Name
      */
     public String getName()
     {
@@ -305,7 +304,7 @@
      * Same as invoking <code>Node.getPath()</code> unless url explicitly set.
      *
      * @see org.apache.jetspeed.page.document.Node#getUrl()
-     * @return
+     * @return url as string
      */
     public String getUrl()
     {
@@ -334,7 +333,7 @@
      * </p>
      *
      * @see org.apache.jetspeed.page.document.Node#isHidden()
-     * @return
+     * @return hidden
      */
     public boolean isHidden()
     {
@@ -356,7 +355,7 @@
         return profiledPath;
     }
     /**
-     * @param path The profiled path to set.
+     * @param profiledPath The profiled path to set.
      */
     public void setProfiledPath( String profiledPath )
     {
@@ -366,7 +365,7 @@
     /**
      * getEffectivePageSecurity
      *
-     * @see org.apache.jetspeed.om.page.psml.AbstractElementImpl#getEffectivePageSecurity()
+     * @see org.apache.jetspeed.om.page.psml.AbstractBaseElement#getEffectivePageSecurity()
      */
     public PageSecurity getEffectivePageSecurity()
     {
@@ -436,25 +435,25 @@
      * </p>
      *
      * @param path
-     * @param actions
+     * @param mask Mask of actions requested
      * @param checkNodeOnly
      * @param checkParentsOnly
      * @throws SecurityException
      */
-    public void checkPermissions(String path, String actions, boolean checkNodeOnly, boolean
checkParentsOnly) throws SecurityException
+    public void checkPermissions(String path, int mask, boolean checkNodeOnly, boolean checkParentsOnly)
throws SecurityException
     {
         // check granted node permissions unless the check is
         // to be skipped due to explicity granted access
         if (!checkParentsOnly)
         {
-            super.checkPermissions(path, actions, true, false);
+            super.checkPermissions(path, mask, true, false);
         }
         
         // if not checking node only, recursively check
         // all parent permissions in hierarchy
         if (!checkNodeOnly && (parent != null))
         {
-            ((AbstractNode)parent).checkPermissions(actions, false, false);
+            ((AbstractNode)parent).checkPermissions(mask, false, false);
         }
     }
 

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
Sat Jan 28 11:09:33 2006
@@ -20,9 +20,9 @@
 
 import javax.security.auth.Subject;
 
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport;
 import org.apache.jetspeed.exception.JetspeedException;
-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;
@@ -424,7 +424,7 @@
         if (cachedNode instanceof Page)
         {
             // check for view access on page
-            cachedNode.checkAccess(SecuredResource.VIEW_ACTION);
+            cachedNode.checkAccess(JetspeedActions.VIEW);
 
             return (Page)cachedNode;
         }
@@ -444,7 +444,7 @@
             }
 
             // check for view access on page
-            page.checkAccess(SecuredResource.VIEW_ACTION);
+            page.checkAccess(JetspeedActions.VIEW);
 
             return page;
         }
@@ -484,7 +484,7 @@
         if (cachedNode instanceof Link)
         {
             // check for view access on link
-            cachedNode.checkAccess(SecuredResource.VIEW_ACTION);
+            cachedNode.checkAccess(JetspeedActions.VIEW);
 
             return (Link)cachedNode;
         }
@@ -504,7 +504,7 @@
             }
 
             // check for view access on link
-            link.checkAccess(SecuredResource.VIEW_ACTION);
+            link.checkAccess(JetspeedActions.VIEW);
 
             return link;
         }
@@ -535,7 +535,7 @@
         if (cachedNode instanceof PageSecurity)
         {
             // check for view access on document
-            cachedNode.checkAccess(SecuredResource.VIEW_ACTION);
+            cachedNode.checkAccess(JetspeedActions.VIEW);
 
             return (PageSecurity)cachedNode;
         }
@@ -555,7 +555,7 @@
             }
 
             // check for view access on document
-            document.checkAccess(SecuredResource.VIEW_ACTION);
+            document.checkAccess(JetspeedActions.VIEW);
 
             return document;
         }
@@ -586,7 +586,7 @@
         if (cachedNode instanceof Folder)
         {
             // check for view access on folder
-            cachedNode.checkAccess(SecuredResource.VIEW_ACTION);
+            cachedNode.checkAccess(JetspeedActions.VIEW);
 
             return (Folder)cachedNode;
         }
@@ -606,7 +606,7 @@
             }
 
             // check for view access on folder
-            folder.checkAccess(SecuredResource.VIEW_ACTION);
+            folder.checkAccess(JetspeedActions.VIEW);
 
             return folder;
         }
@@ -660,7 +660,7 @@
                 
                 // check for edit access on parent folder; page
                 // access not checked on create
-                parent.checkAccess(SecuredResource.EDIT_ACTION);
+                parent.checkAccess(JetspeedActions.EDIT);
 
                 try
                 {
@@ -682,7 +682,7 @@
             else
             {
                 // check for edit access on page and parent folder
-                page.checkAccess(SecuredResource.EDIT_ACTION);
+                page.checkAccess(JetspeedActions.EDIT);
 
                 // update page
                 getPersistenceBrokerTemplate().store(page);
@@ -720,7 +720,7 @@
             page = (Page)ProxyHelper.getRealObject(page);
 
             // check for edit access on page and parent folder
-            page.checkAccess(SecuredResource.EDIT_ACTION);
+            page.checkAccess(JetspeedActions.EDIT);
 
             // look up and update parent folder if necessary
             if (page.getParent() != null)
@@ -781,7 +781,7 @@
                 
                 // check for edit access on parent folder; folder
                 // access not checked on create
-                parent.checkAccess(SecuredResource.EDIT_ACTION);
+                parent.checkAccess(JetspeedActions.EDIT);
 
                 try
                 {
@@ -810,7 +810,7 @@
                 // checked on create
                 if (!newFolder || !folder.getPath().equals(Folder.PATH_SEPARATOR))
                 {
-                    folder.checkAccess(SecuredResource.EDIT_ACTION);
+                    folder.checkAccess(JetspeedActions.EDIT);
                 }
 
                 // create root folder or update folder
@@ -852,7 +852,7 @@
             folder = (Folder)ProxyHelper.getRealObject(folder);
 
             // check for edit access on folder and parent folder
-            folder.checkAccess(SecuredResource.EDIT_ACTION);
+            folder.checkAccess(JetspeedActions.EDIT);
 
             // look up and update parent folder if necessary
             if (folder.getParent() != null)
@@ -913,7 +913,7 @@
                 
                 // check for edit access on parent folder; link
                 // access not checked on create
-                parent.checkAccess(SecuredResource.EDIT_ACTION);
+                parent.checkAccess(JetspeedActions.EDIT);
 
                 try
                 {
@@ -935,7 +935,7 @@
             else
             {
                 // check for edit access on link and parent folder
-                link.checkAccess(SecuredResource.EDIT_ACTION);
+                link.checkAccess(JetspeedActions.EDIT);
 
                 // update link
                 getPersistenceBrokerTemplate().store(link);
@@ -969,7 +969,7 @@
             link = (Link)ProxyHelper.getRealObject(link);
 
             // check for edit access on link and parent folder
-            link.checkAccess(SecuredResource.EDIT_ACTION);
+            link.checkAccess(JetspeedActions.EDIT);
 
             // look up and update parent folder if necessary
             if (link.getParent() != null)
@@ -1039,7 +1039,7 @@
                 {
                     // check for edit access on parent folder; document
                     // access not checked on create
-                    parent.checkAccess(SecuredResource.EDIT_ACTION);
+                    parent.checkAccess(JetspeedActions.EDIT);
                     
                     try
                     {
@@ -1066,7 +1066,7 @@
             else
             {
                 // check for edit access on document and parent folder
-                pageSecurity.checkAccess(SecuredResource.EDIT_ACTION);
+                pageSecurity.checkAccess(JetspeedActions.EDIT);
 
                 // update document
                 getPersistenceBrokerTemplate().store(pageSecurity);
@@ -1103,7 +1103,7 @@
             pageSecurity = (PageSecurity)ProxyHelper.getRealObject(pageSecurity);
 
             // check for edit access on document and parent folder
-            pageSecurity.checkAccess(SecuredResource.EDIT_ACTION);
+            pageSecurity.checkAccess(JetspeedActions.EDIT);
 
             // look up and update parent folder if necessary
             if (pageSecurity.getParent() != null)

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java
Sat Jan 28 11:09:33 2006
@@ -23,6 +23,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.cache.file.FileCache;
 import org.apache.jetspeed.cache.file.FileCacheEntry;
 import org.apache.jetspeed.cache.file.FileCacheEventListener;
@@ -214,7 +215,7 @@
         pageImpl.setConstraintsEnabled(handlerFactory.getConstraintsEnabled());
 
         // check for edit access
-        page.checkAccess(SecuredResource.EDIT_ACTION);
+        page.checkAccess(JetspeedActions.EDIT);
 
         // update page
         handlerFactory.getDocumentHandler(Page.DOCUMENT_TYPE).updateDocument(page);
@@ -253,7 +254,7 @@
         }
 
         // check for edit access
-        page.checkAccess(SecuredResource.EDIT_ACTION);
+        page.checkAccess(JetspeedActions.EDIT);
 
         // remove page
         handlerFactory.getDocumentHandler(Page.DOCUMENT_TYPE).removeDocument(page);
@@ -325,7 +326,7 @@
         linkImpl.setConstraintsEnabled(handlerFactory.getConstraintsEnabled());
 
         // check for edit access
-        link.checkAccess(SecuredResource.EDIT_ACTION);
+        link.checkAccess(JetspeedActions.EDIT);
 
         // update link
         handlerFactory.getDocumentHandler(Link.DOCUMENT_TYPE).updateDocument(link);
@@ -358,7 +359,7 @@
     public void removeLink(Link link) throws JetspeedException
     {
         // check for edit access
-        link.checkAccess(SecuredResource.EDIT_ACTION);
+        link.checkAccess(JetspeedActions.EDIT);
 
         // remove link
         handlerFactory.getDocumentHandler(Link.DOCUMENT_TYPE).removeDocument(link);
@@ -431,7 +432,7 @@
         pageSecurityImpl.setConstraintsEnabled(handlerFactory.getConstraintsEnabled());
 
         // check for edit access
-        pageSecurity.checkAccess(SecuredResource.EDIT_ACTION);
+        pageSecurity.checkAccess(JetspeedActions.EDIT);
 
         // update pageSecurity
         handlerFactory.getDocumentHandler(PageSecurity.DOCUMENT_TYPE).updateDocument(pageSecurity);
@@ -460,7 +461,7 @@
     public void removePageSecurity(PageSecurity pageSecurity) throws JetspeedException, FailedToDeleteDocumentException
     {
         // check for edit access
-        pageSecurity.checkAccess(SecuredResource.EDIT_ACTION);
+        pageSecurity.checkAccess(JetspeedActions.EDIT);
 
         // remove page security
         handlerFactory.getDocumentHandler(PageSecurity.DOCUMENT_TYPE).removeDocument(pageSecurity);
@@ -489,7 +490,7 @@
     {
         // get folder and check access before returning
         Folder folder = folderHandler.getFolder(folderPath);
-        folder.checkAccess(SecuredResource.VIEW_ACTION);
+        folder.checkAccess(JetspeedActions.VIEW);
         return folder;
     }
 
@@ -542,7 +543,7 @@
         folderImpl.setFolderHandler(folderHandler);
 
         // check for edit access
-        folder.checkAccess(SecuredResource.EDIT_ACTION);
+        folder.checkAccess(JetspeedActions.EDIT);
 
         // update folder
         folderHandler.updateFolder(folder);
@@ -575,7 +576,7 @@
     public void removeFolder(Folder folder) throws JetspeedException
     {
         // check for edit access
-        folder.checkAccess(SecuredResource.EDIT_ACTION);
+        folder.checkAccess(JetspeedActions.EDIT);
 
         // remove folder
         folderHandler.removeFolder(folder);

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=373218&r1=373217&r2=373218&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
Sat Jan 28 11:09:33 2006
@@ -27,6 +27,7 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.om.common.GenericMetadata;
 import org.apache.jetspeed.om.common.SecurityConstraint;
 import org.apache.jetspeed.om.common.SecurityConstraints;
@@ -271,7 +272,7 @@
         SecurityConstraint constraint = page.newSecurityConstraint();
         constraint.setUsers(Shared.makeListFromCSV("user10,user11"));
         constraint.setRoles(Shared.makeListFromCSV("*"));
-        constraint.setPermissions(Shared.makeListFromCSV(page.EDIT_ACTION + "," + page.VIEW_ACTION));
+        constraint.setPermissions(Shared.makeListFromCSV(JetspeedActions.EDIT + "," + JetspeedActions.VIEW));
         constraintsList.add(constraint);
         constraints.setSecurityConstraints(constraintsList);
         List constraintsRefsList = new ArrayList(1);

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java
Sat Jan 28 11:09:33 2006
@@ -98,9 +98,9 @@
     }
     
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.om.common.SecuredResource#checkPermissions(java.lang.String)
+     * @see org.apache.jetspeed.om.common.SecuredResource#checkPermissions(int)
      */
-    public void checkPermissions(String actions) throws SecurityException
+    public void checkPermissions(int mask) throws SecurityException
     {
     }
     

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/AddPortletAction.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/AddPortletAction.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/AddPortletAction.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/AddPortletAction.java
Sat Jan 28 11:09:33 2006
@@ -19,13 +19,13 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.ajax.AJAXException;
 import org.apache.jetspeed.ajax.AjaxAction;
 import org.apache.jetspeed.ajax.AjaxBuilder;
 import org.apache.jetspeed.layout.Coordinate;
 import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
 import org.apache.jetspeed.layout.PortletPlacementContext;
-import org.apache.jetspeed.om.common.SecuredResource;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.page.PageManager;
@@ -79,7 +79,7 @@
                 throw new RuntimeException("portlet id not provided"); 
             }
             resultMap.put(PORTLETID, portletId);
-            if (false == checkAccess(requestContext, SecuredResource.EDIT_ACTION))
+            if (false == checkAccess(requestContext, JetspeedActions.EDIT))
             {
                 if (!createNewPageOnEdit(requestContext))
                 {

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/BasePortletAction.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/BasePortletAction.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/BasePortletAction.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/BasePortletAction.java
Sat Jan 28 11:09:33 2006
@@ -91,7 +91,12 @@
 
     public boolean checkAccess(RequestContext context, String action)
     {
-        return securityBehavior.checkAccess(context, action);
+        boolean access = true;
+        if (null != securityBehavior)
+        {
+            access = securityBehavior.checkAccess(context, action);
+        }
+        return access;
     }
 
     public boolean createNewPageOnEdit(RequestContext context)

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPageAction.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPageAction.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPageAction.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPageAction.java
Sat Jan 28 11:09:33 2006
@@ -19,10 +19,10 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.ajax.AjaxAction;
 import org.apache.jetspeed.ajax.AjaxBuilder;
 import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
-import org.apache.jetspeed.om.common.SecuredResource;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.page.PageManager;
 import org.apache.jetspeed.request.RequestContext;
@@ -57,7 +57,7 @@
         try
         {
             resultMap.put(ACTION, "getpage");
-            if (false == checkAccess(requestContext, SecuredResource.VIEW_ACTION))
+            if (false == checkAccess(requestContext, JetspeedActions.VIEW))
             {
                 resultMap.put(REASON, "Insufficient access to view page");
                 success = false;

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPagesAction.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPagesAction.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPagesAction.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPagesAction.java
Sat Jan 28 11:09:33 2006
@@ -24,10 +24,10 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.ajax.AjaxAction;
 import org.apache.jetspeed.ajax.AjaxBuilder;
 import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
-import org.apache.jetspeed.om.common.SecuredResource;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.page.PageManager;
@@ -63,7 +63,7 @@
         try
         {
             resultMap.put(ACTION, "getpages");
-            if (false == checkAccess(requestContext, SecuredResource.VIEW_ACTION))
+            if (false == checkAccess(requestContext, JetspeedActions.VIEW))
             {
 //                if (!createNewPageOnEdit(requestContext))                
 //                {

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPortletsAction.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPortletsAction.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPortletsAction.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/GetPortletsAction.java
Sat Jan 28 11:09:33 2006
@@ -15,6 +15,8 @@
  */
 package org.apache.jetspeed.layout.impl;
 
+import java.security.AccessControlException;
+import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -28,11 +30,11 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.ajax.AjaxAction;
 import org.apache.jetspeed.ajax.AjaxBuilder;
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
-import org.apache.jetspeed.om.common.SecuredResource;
 import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
 import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
 import org.apache.jetspeed.page.PageManager;
@@ -82,7 +84,7 @@
         try
         {
             resultMap.put(ACTION, "getportlets");
-            if (false == checkAccess(requestContext, SecuredResource.VIEW_ACTION))
+            if (false == checkAccess(requestContext, JetspeedActions.VIEW))
             {
 //                if (!createNewPageOnEdit(requestContext))
 //                {
@@ -141,14 +143,14 @@
             
             // SECURITY filtering
             String uniqueName = appName + "::" + portlet.getName();
-            if (subject != null)
+            try
             {
-                if (permissionManager.checkPermission(subject, 
-                    new PortletPermission(portlet.getUniqueName(), 
-                    SecuredResource.VIEW_ACTION, subject )))
-                {
-                    list.add(new PortletInfo(uniqueName, portlet.getDisplayNameText(locale),
portlet.getDescriptionText(locale)));
-                }
+                AccessController.checkPermission(new PortletPermission(portlet.getUniqueName(),
JetspeedActions.VIEW));
+                list.add(new PortletInfo(uniqueName, portlet.getDisplayNameText(locale),
portlet.getDescriptionText(locale)));
+            }
+            catch (AccessControlException ace)
+            {
+                //continue
             }
         }            
         Collections.sort(list, this);

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/MovePortletAction.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/MovePortletAction.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/MovePortletAction.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/MovePortletAction.java
Sat Jan 28 11:09:33 2006
@@ -19,13 +19,13 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.ajax.AJAXException;
 import org.apache.jetspeed.ajax.AjaxAction;
 import org.apache.jetspeed.ajax.AjaxBuilder;
 import org.apache.jetspeed.layout.Coordinate;
 import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
 import org.apache.jetspeed.layout.PortletPlacementContext;
-import org.apache.jetspeed.om.common.SecuredResource;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.page.PageManager;
@@ -114,7 +114,7 @@
                 throw new Exception("portlet id not provided"); 
             }            
             resultMap.put(PORTLETID, portletId);            
-            if (false == checkAccess(requestContext, SecuredResource.EDIT_ACTION))
+            if (false == checkAccess(requestContext, JetspeedActions.EDIT))
             {
                 Page page = requestContext.getPage();
                 Fragment fragment = page.getFragmentById(portletId);

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/PortletActionSecurityPathBehavior.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/PortletActionSecurityPathBehavior.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/PortletActionSecurityPathBehavior.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/PortletActionSecurityPathBehavior.java
Sat Jan 28 11:09:33 2006
@@ -15,12 +15,10 @@
  */
 package org.apache.jetspeed.layout.impl;
 
-import javax.security.auth.Subject;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
-import org.apache.jetspeed.om.common.SecuredResource;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.page.ContentPageImpl;
 import org.apache.jetspeed.om.page.Page;
@@ -51,18 +49,13 @@
             return false;
         if (path.indexOf(Folder.ROLE_FOLDER) > -1 || path.indexOf(Folder.GROUP_FOLDER)
> -1)
         {
-            if (action.equals(SecuredResource.VIEW_ACTION))
+            if (action.equals(JetspeedActions.VIEW))
                 return true;
             return false;
         }
         return true;
     }
 
-    public Subject getSubject(RequestContext context)
-    {
-        return context.getSubject();
-    }
-    
     public boolean createNewPageOnEdit(RequestContext context)
     {
         Page page = context.getPage();        
@@ -74,7 +67,7 @@
             // make sure we are not copying from user area
             if (path.indexOf(Folder.USER_FOLDER) == -1)
             {
-                this.pageManager.createUserHomePagesFromRoles(getSubject(context));
+                this.pageManager.createUserHomePagesFromRoles(context.getSubject());
                 page = this.pageManager.getPage(Folder.USER_FOLDER 
                                                 + context.getRequest().getUserPrincipal().getName()
                                                 + Folder.PATH_SEPARATOR 

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/RemovePortletAction.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/RemovePortletAction.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/RemovePortletAction.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/RemovePortletAction.java
Sat Jan 28 11:09:33 2006
@@ -19,11 +19,11 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.ajax.AjaxAction;
 import org.apache.jetspeed.ajax.AjaxBuilder;
 import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
 import org.apache.jetspeed.layout.PortletPlacementContext;
-import org.apache.jetspeed.om.common.SecuredResource;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.page.PageManager;
@@ -79,7 +79,7 @@
                 return success;
             }
             resultMap.put(PORTLETID, portletId);
-            if (false == checkAccess(requestContext, SecuredResource.EDIT_ACTION))
+            if (false == checkAccess(requestContext, JetspeedActions.EDIT))
             {
                 Page page = requestContext.getPage();
                 Fragment fragment = page.getFragmentById(portletId);

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/PageActionAccess.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/PageActionAccess.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/PageActionAccess.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/PageActionAccess.java
Sat Jan 28 11:09:33 2006
@@ -152,7 +152,7 @@
         boolean allowed = false;
         try
         {
-            page.checkAccess(Page.EDIT_ACTION);
+            page.checkAccess(JetspeedActions.EDIT);
             allowed = true;
         }       
         catch (SecurityException se) {}

Modified: portals/jetspeed-2/trunk/components/portal/src/test/resources/assembly/test-layout-api.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/test/resources/assembly/test-layout-api.xml?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/test/resources/assembly/test-layout-api.xml
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/test/resources/assembly/test-layout-api.xml
Sat Jan 28 11:09:33 2006
@@ -10,6 +10,14 @@
     index 1 = action name from AJAX Request
     
     -->
+
+<!--bean id="PortletActionSecurityBehavior"
+	  class="org.apache.jetspeed.layout.impl.PortletActionSecurityPathBehavior">
+    <constructor-arg index='0'>
+        <ref bean="org.apache.jetspeed.page.PageManager"/>        
+    </constructor-arg>    	
+</bean-->
+
 <bean id="AjaxMovePortletAbsolute"
     class="org.apache.jetspeed.layout.impl.MovePortletAction">
     <constructor-arg index="0">
@@ -21,11 +29,12 @@
     <constructor-arg index="2">
         <value>moveabs</value>
     </constructor-arg>
-<!--    
-    <constructor-arg index='3'>
+    <!--constructor-arg index='3'>
         <ref bean="org.apache.jetspeed.page.PageManager"/>        
     </constructor-arg>    
-  -->
+    <constructor-arg index='4'>
+        <ref bean="PortletActionSecurityBehavior"/>        
+    </constructor-arg-->   
 </bean>
 
 <bean id="AjaxMovePortletLeft"
@@ -39,11 +48,12 @@
     <constructor-arg index="2">
         <value>moveleft</value>
     </constructor-arg>
-<!--    
-    <constructor-arg index='3'>
+    <!-- constructor-arg index='3'>
         <ref bean="org.apache.jetspeed.page.PageManager"/>        
     </constructor-arg>        
-  -->
+    <constructor-arg index='4'>
+        <ref bean="PortletActionSecurityBehavior"/>        
+    </constructor-arg-->  
 </bean>
 
 <bean id="AjaxMovePortletRight"
@@ -57,11 +67,12 @@
     <constructor-arg index="2">
         <value>moveright</value>
     </constructor-arg>
- <!--
-    <constructor-arg index='3'>
+    <!-- constructor-arg index='3'>
         <ref bean="org.apache.jetspeed.page.PageManager"/>        
-    </constructor-arg>        
-  -->    
+    </constructor-arg>      
+    <constructor-arg index='4'>
+        <ref bean="PortletActionSecurityBehavior"/>        
+    </constructor-arg-->  
 </bean>
 
 <bean id="AjaxMovePortletUp"
@@ -75,11 +86,12 @@
     <constructor-arg index="2">
         <value>moveup</value>
     </constructor-arg>
-<!--    
-    <constructor-arg index='3'>
+    <!-- constructor-arg index='3'>
         <ref bean="org.apache.jetspeed.page.PageManager"/>        
-    </constructor-arg>        
- -->    
+    </constructor-arg>      
+    <constructor-arg index='4'>
+        <ref bean="PortletActionSecurityBehavior"/>        
+    </constructor-arg-->  
 </bean>
 
 <bean id="AjaxMovePortletDown"
@@ -93,11 +105,12 @@
     <constructor-arg index="2">
         <value>movedown</value>
     </constructor-arg>
-<!--    
-    <constructor-arg index='3'>
+    <!-- constructor-arg index='3'>
         <ref bean="org.apache.jetspeed.page.PageManager"/>        
-    </constructor-arg>        
-  -->    
+    </constructor-arg>      
+    <constructor-arg index='4'>
+        <ref bean="PortletActionSecurityBehavior"/>        
+    </constructor-arg-->    
 </bean>
 
 <bean id="AjaxAddPortlet"
@@ -108,11 +121,12 @@
     <constructor-arg index="1">
         <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
     </constructor-arg>
-<!--    
-    <constructor-arg index='2'>
+    <!-- constructor-arg index='2'>
         <ref bean="org.apache.jetspeed.page.PageManager"/>        
-    </constructor-arg>        
-  -->    
+    </constructor-arg>      
+    <constructor-arg index='3'>
+        <ref bean="PortletActionSecurityBehavior"/>        
+    </constructor-arg-->    
 </bean>
 
 <bean id="AjaxRemovePortlet"
@@ -123,11 +137,12 @@
     <constructor-arg index="1">
         <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
     </constructor-arg>
-<!--    
-    <constructor-arg index='2'>
+    <!-- constructor-arg index='2'>
         <ref bean="org.apache.jetspeed.page.PageManager"/>        
     </constructor-arg>        
- -->    
+    <constructor-arg index='3'>
+        <ref bean="PortletActionSecurityBehavior"/>        
+    </constructor-arg-->   
 </bean>
 
 

Modified: portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java
Sat Jan 28 11:09:33 2006
@@ -95,12 +95,12 @@
         }
 
         /**
-         * @param actions
+         * @param mask
          * @throws SecurityException
          */
-        public void checkPermissions(String actions) throws SecurityException
+        public void checkPermissions(int mask) throws SecurityException
         {
-            f.checkPermissions(actions);
+            f.checkPermissions(mask);
         }
         
         public SecurityConstraint newSecurityConstraint()
@@ -122,7 +122,7 @@
         }
 
         /**
-         * @return
+         * @return contraints enabled
          */
         public boolean getConstraintsEnabled()
         {
@@ -130,7 +130,7 @@
         }
 
         /**
-         * @return
+         * @return decorator name
          */
         public String getDecorator()
         {
@@ -138,7 +138,7 @@
         }
 
         /**
-         * @return
+         * @return list of fragments
          */
         public List getFragments()
         {
@@ -146,7 +146,7 @@
         }
 
         /**
-         * @return
+         * @return id
          */
         public String getId()
         {
@@ -154,7 +154,7 @@
         }
 
         /**
-         * @return
+         * @return name
          */
         public String getName()
         {
@@ -162,7 +162,7 @@
         }
 
         /**
-         * @return
+         * @return permissions enabled
          */
         public boolean getPermissionsEnabled()
         {
@@ -171,7 +171,7 @@
 
 
         /**
-         * @return
+         * @return security constraints
          */
         public SecurityConstraints getSecurityConstraints()
         {
@@ -179,7 +179,7 @@
         }
 
         /**
-         * @return
+         * @return  short title
          */
         public String getShortTitle()
         {
@@ -187,7 +187,7 @@
         }
 
         /**
-         * @return
+         * @return skin name
          */
         public String getSkin()
         {
@@ -195,7 +195,7 @@
         }
 
         /**
-         * @return
+         * @return state string
          */
         public String getState()
         {
@@ -203,7 +203,7 @@
         }
 
         /**
-         * @return
+         * @return title
          */
         public String getTitle()
         {
@@ -211,7 +211,7 @@
         }
 
         /**
-         * @return
+         * @return type string
          */
         public String getType()
         {
@@ -227,7 +227,7 @@
         }
 
         /**
-         * @return
+         * @return if its a reference
          */
         public boolean isReference()
         {
@@ -398,7 +398,7 @@
         }
 
         /**
-         * @see org.apache.jetspeed.om.page.Fragment#setPreferences()
+         * @see org.apache.jetspeed.om.page.Fragment#setPreferences(java.util.List)
          */
         public void setPreferences(List preferences)
         {

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java?rev=373218&r1=373217&r2=373218&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java
Sat Jan 28 11:09:33 2006
@@ -31,8 +31,6 @@
  */
 public interface SecuredResource
 {   
-    String VIEW_ACTION = "view";
-    String EDIT_ACTION = "edit";
 
     /**
      * <p>
@@ -103,10 +101,10 @@
      * checkPermissions
      * </p>
      *
-     * @param actions list to be checked against in CSV string form
+     * @param mask Mask of actions to be checked
      * @throws SecurityException
      */
-    void checkPermissions(String actions) throws SecurityException;
+    void checkPermissions(int mask) throws SecurityException;
 
     /**
      * <p>



---------------------------------------------------------------------
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