taylor      2004/11/18 19:07:02

  Modified:    jetspeed-api/src/java/org/apache/jetspeed/page/document
                        DocumentHandler.java Node.java
                        DocumentHandlerFactory.java
               jetspeed-api/src/java/org/apache/jetspeed/om/common
                        SecuredResource.java
               jetspeed-api/src/java/org/apache/jetspeed/om/page
                        BaseElement.java
               jetspeed-api/src/java/org/apache/jetspeed/page
                        PageManager.java
  Added:       jetspeed-api/src/java/org/apache/jetspeed/om/common
                        SecurityConstraints.java SecurityConstraint.java
               jetspeed-api/src/java/org/apache/jetspeed/om/page
                        PageSecurity.java SecurityConstraintsDef.java
  Log:
  ** File and Folder Security Permission Checking **
      patch by contrinbuted by Randy Watler
  
  - Both permissions, (JAAS), and constraints, (J1 style), are enabled,
  (in assembly/page-manager.xml on the CastorXmlPageManager init)
  - Both are configured to secure the same entities, except the testsuite
  page access is specified only in the constraints.
  - The permissions are configured in the 4 populate-userinfo sql scripts.
  - The constraints are set up in WEB-INF/pages:
   /page.security
   /folder.metadata
   /Administrative/folder.metadata
   /default-page.psml
   /testsuite.psml
   /_user/user/folder.metadata
  - We'll need to add a CVS text wrapper for *.security.
  
  To test:
  
  1. When you start the portal, you should see only the default page and
    additional links, (no customizer buttons)
  2. Login as user: you should see everything as before except the
    testsuite page and the Administrative sub directory, (customizer
    buttons only visible on user pages)
  3. Login as manager: everything should be be visible except the
    testsuite page, (no customizer buttons)
  4. Login as jetspeed: everything should be visible, (no customizer
    buttons)
  5. Login as admin: everything should be visible, (full customizer
    buttons)
  
  Revision  Changes    Path
  1.2       +5 -1      
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/document/DocumentHandler.java
  
  Index: DocumentHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/document/DocumentHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DocumentHandler.java      3 Sep 2004 13:24:05 -0000       1.1
  +++ DocumentHandler.java      19 Nov 2004 03:07:01 -0000      1.2
  @@ -39,4 +39,8 @@
       void removeDocument(Document document)  throws 
DocumentNotFoundException, FailedToDeleteDocumentException;
       
       String getType();
  +
  +    DocumentHandlerFactory getHandlerFactory();
  +
  +    void setHandlerFactory(DocumentHandlerFactory factory);
   }
  
  
  
  1.4       +13 -1     
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/document/Node.java
  
  Index: Node.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/document/Node.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Node.java 21 Oct 2004 02:30:16 -0000      1.3
  +++ Node.java 19 Nov 2004 03:07:01 -0000      1.4
  @@ -116,6 +116,18 @@
       /**
        * 
        * <p>
  +     * getShortTitle
  +     * </p>
  +     * Returns the short title for the specified locale.
  +     *
  +     * @param locale
  +     * @return localized title of this Node.
  +     */
  +    String getShortTitle(Locale locale);
  +
  +    /**
  +     * 
  +     * <p>
        * getType
        * </p>
        * 
  
  
  
  1.2       +36 -2     
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/document/DocumentHandlerFactory.java
  
  Index: DocumentHandlerFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/document/DocumentHandlerFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DocumentHandlerFactory.java       3 Sep 2004 13:24:05 -0000       1.1
  +++ DocumentHandlerFactory.java       19 Nov 2004 03:07:01 -0000      1.2
  @@ -63,5 +63,39 @@
        */
       void registerDocumentHandler(DocumentHandler documentHandler) throws 
DocumentTypeAlreadyRegisteredException;
       
  -    
  +    /**
  +     * <p>
  +     * getConstraintsEnabled
  +     * </p>
  +     *
  +     * @return enabled indicator
  +     */
  +    boolean getConstraintsEnabled();
  +
  +    /**
  +     * <p>
  +     * setConstraintsEnabled
  +     * </p>
  +     *
  +     * @param enabled indicator
  +     */
  +    void setConstraintsEnabled(boolean enabled);
  +
  +    /**
  +     * <p>
  +     * getPermissionsEnabled
  +     * </p>
  +     *
  +     * @return enabled indicator
  +     */
  +    boolean getPermissionsEnabled();
  +
  +    /**
  +     * <p>
  +     * setPermissionsEnabled
  +     * </p>
  +     *
  +     * @param enabled indicator
  +     */
  +    void setPermissionsEnabled(boolean enabled);
   }
  
  
  
  1.2       +59 -10    
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java
  
  Index: SecuredResource.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecuredResource.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SecuredResource.java      15 Jul 2004 22:52:38 -0000      1.1
  +++ SecuredResource.java      19 Nov 2004 03:07:01 -0000      1.2
  @@ -15,12 +15,13 @@
    */
   package org.apache.jetspeed.om.common;
   
  +
   /**
    * <p>
    * SecuredResource
    * </p>
    * <p>
  - * Implemented by those resources that have an Acl defined for
  + * Implemented by those resources that have a security constraint defined for
    * security purposes.
    *
    * </p>
  @@ -30,24 +31,72 @@
    */
   public interface SecuredResource
   {   
  +    String VIEW_ACTION = "view";
  +    String EDIT_ACTION = "edit";
  +
  +    /**
  +     * <p>
  +     * getConstraintsEnabled
  +     * </p>
  +     *
  +     * @return enabled indicator
  +     */
  +    boolean getConstraintsEnabled();
  +    
       /**
  -     * 
        * <p>
  -     * getAcl
  +     * getSecurityConstraints
        * </p>
        *
  -     * @return
  +     * @return security constraints for resource
        */
  -    String getAcl();
  +    SecurityConstraints getSecurityConstraints();
       
       /**
  -     * 
        * <p>
  -     * setAcl
  +     * setSecurityConstraints
        * </p>
        *
  -     * @param acl 
  +     * @param constraints security constraints for resource
        */
  -    void setAcl(String acl);
  +    void setSecurityConstraints(SecurityConstraints constraints);
   
  +    /**
  +     * <p>
  +     * checkConstraints
  +     * </p>
  +     *
  +     * @param actions list to be checked against in CSV string form
  +     * @throws SecurityException
  +     */
  +    void checkConstraints(String actions) throws SecurityException;
  +
  +    /**
  +     * <p>
  +     * getPermissionsEnabled
  +     * </p>
  +     *
  +     * @return enabled indicator
  +     */
  +    boolean getPermissionsEnabled();
  +    
  +    /**
  +     * <p>
  +     * checkPermissions
  +     * </p>
  +     *
  +     * @param actions list to be checked against in CSV string form
  +     * @throws SecurityException
  +     */
  +    void checkPermissions(String actions) throws SecurityException;
  +
  +    /**
  +     * <p>
  +     * checkAccess
  +     * </p>
  +     *
  +     * @param actions list to be checked against in CSV string form
  +     * @throws SecurityException
  +     */
  +    void checkAccess(String actions) throws SecurityException;
   }
  
  
  
  1.1                  
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecurityConstraints.java
  
  Index: SecurityConstraints.java
  ===================================================================
  /*
   * Copyright 2000-2001,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.om.common;
  
  import java.util.List;
  
  /**
   * <p>
   * SecurityConstraints
   * </p>
   * <p>
   * Used to specify security constraints for a resource.
   *
   * </p>
   * @author <a href="mailto:[EMAIL PROTECTED]">Randy Watler</a>
   * @version $Id: SecurityConstraints.java,v 1.1 2004/11/19 03:07:01 taylor 
Exp $
   *
   */
  public interface SecurityConstraints
  {   
      /**
       * <p>
       * getOwner
       * </p>
       *
       * @return owner constraint for resource 
       */
      String getOwner();
      
      /**
       * <p>
       * setOwner
       * </p>
       *
       * @param owner constraint for resource
       */
      void setOwner(String owner);
  
      /**
       * <p>
       * getSecurityConstraints
       * </p>
       *
       * @return security constraints list for resource
       */
      List getSecurityConstraints();
      
      /**
       * <p>
       * setSecurityConstraint
       * </p>
       *
       * @param constraints security constraints for resource
       */
      void setSecurityConstraints(List constraints);
  
      /**
       * <p>
       * getSecurityConstraintsRefs
       * </p>
       *
       * @return security constraints references for resource
       */
      List getSecurityConstraintsRefs();
      
      /**
       * <p>
       * setSecurityConstraintsRefs
       * </p>
       *
       * @param constraintsRefs security constraints references for resource
       */
      void setSecurityConstraintsRefs(List constraintsRefs);
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecurityConstraint.java
  
  Index: SecurityConstraint.java
  ===================================================================
  /*
   * Copyright 2000-2001,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.om.common;
  
  import java.util.List;
  
  /**
   * <p>
   * SecurityConstraint
   * </p>
   * <p>
   * Used by SecureResource to specify access constraints for
   * security purposes.
   *
   * </p>
   * @author <a href="mailto:[EMAIL PROTECTED]">Randy Watler</a>
   * @version $Id: SecurityConstraint.java,v 1.1 2004/11/19 03:07:01 taylor Exp 
$
   *
   */
  public interface SecurityConstraint
  {   
      String WILD_CHAR = "*";    
  
      /**
       * <p>
       * getUsers
       * </p>
       *
       * @return constraint users in CSV string form
       */
      String getUsers();
      
      /**
       * <p>
       * getUsersList
       * </p>
       *
       * @return constraint users as List
       */
      List getUsersList();
      
      /**
       * <p>
       * setUsers
       * </p>
       *
       * @param users constraint list in CSV string form
       */
      void setUsers(String users);
  
      /**
       * <p>
       * getRoles
       * </p>
       *
       * @return constraint roles in CSV string form
       */
      String getRoles();
      
      /**
       * <p>
       * getRolesList
       * </p>
       *
       * @return constraint roles as List
       */
      List getRolesList();
      
      /**
       * <p>
       * setRoles
       * </p>
       *
       * @param roles constraint list in CSV string form
       */
      void setRoles(String roles);
  
      /**
       * <p>
       * getGroups
       * </p>
       *
       * @return constraint groups in CSV string form
       */
      String getGroups();
      
      /**
       * <p>
       * getGroupsList
       * </p>
       *
       * @return constraint groups as List
       */
      List getGroupsList();
      
      /**
       * <p>
       * setGroups
       * </p>
       *
       * @param groups constraint list in CSV string form
       */
      void setGroups(String groups);
  
      /**
       * <p>
       * getPermissions
       * </p>
       *
       * @return constraint permissions in CSV string form
       */
      String getPermissions();
      
      /**
       * <p>
       * getPermissionsList
       * </p>
       *
       * @return constraint permissions as List
       */
      List getPermissionsList();
      
      /**
       * <p>
       * setPermissions
       * </p>
       *
       * @param permissions constraint list in CSV string form
       */
      void setPermissions(String permissions);
  }
  
  
  
  1.3       +14 -1     
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/om/page/BaseElement.java
  
  Index: BaseElement.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/om/page/BaseElement.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BaseElement.java  3 Sep 2004 13:24:05 -0000       1.2
  +++ BaseElement.java  19 Nov 2004 03:07:02 -0000      1.3
  @@ -55,5 +55,18 @@
        */
       public void setTitle(String title);
   
  +    /**
  +     * Returns the short title in the default Locale
  +     *
  +     * @return the page short title
  +     */
  +    public String getShortTitle();
  +
  +    /**
  +     * Sets the short title for the default Locale
  +     *
  +     * @param title the new title
  +     */
  +    public void setShortTitle(String title);
           
   }
  
  
  
  1.1                  
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/om/page/PageSecurity.java
  
  Index: PageSecurity.java
  ===================================================================
  /*
   * Copyright 2000-2001,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.om.page;
  
  import java.util.List;
  
  /**
   * <p>
   * Security
   * </p>
   * <p>
   * Used to define named collections of SecurityConstraint objects.
   *
   * </p>
   * @author <a href="mailto:[EMAIL PROTECTED]">Randy Watler</a>
   * @version $Id: PageSecurity.java,v 1.1 2004/11/19 03:07:02 taylor Exp $
   *
   */
  public interface PageSecurity extends Document
  {   
      String DOCUMENT_TYPE = "page.security";
      
      /**
       * <p>
       * getSecurityConstraintsDefs
       * </p>
       *
       * @return security constraints definitions
       */
      List getSecurityConstraintsDefs();
      
      /**
       * <p>
       * setSecurityConstraintsDefs
       * </p>
       *
       * @param defintions security constraints definitions
       */
      void setSecurityConstraintsDefs(List definitions);
  
      /**
       * <p>
       * getSecurityConstraintsDef
       * </p>
       *
       * @param name of security constraints definition to return
       * @return security constraints definition
       */
      SecurityConstraintsDef getSecurityConstraintsDef(String name);
  
      /**
       * <p>
       * getGlobalSecurityConstraintsRefs
       * </p>
       *
       * @return global security constraints references
       */
      List getGlobalSecurityConstraintsRefs();
      
      /**
       * <p>
       * setGlobalSecurityConstraintsRefs
       * </p>
       *
       * @param constraintsRefs global security constraints references
       */
      void setGlobalSecurityConstraintsRefs(List constraintsRefs);
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/om/page/SecurityConstraintsDef.java
  
  Index: SecurityConstraintsDef.java
  ===================================================================
  /*
   * Copyright 2000-2001,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.om.page;
  
  import java.util.List;
  
  /**
   * <p>
   * SecurityConstraintsDef
   * </p>
   * <p>
   * Used to specify a named collection of SecurityConstraint objects.
   *
   * </p>
   * @author <a href="mailto:[EMAIL PROTECTED]">Randy Watler</a>
   * @version $Id: SecurityConstraintsDef.java,v 1.1 2004/11/19 03:07:02 taylor 
Exp $
   *
   */
  public interface SecurityConstraintsDef
  {   
      /**
       * <p>
       * getName
       * </p>
       *
       * @return constraints name used by references
       */
      String getName();
      
      /**
       * <p>
       * setName
       * </p>
       *
       * @param name constraints name used by references
       */
      void setName(String name);
  
      /**
       * <p>
       * getSecurityConstraints
       * </p>
       *
       * @return security constraints list for resource
       */
      List getSecurityConstraints();
      
      /**
       * <p>
       * setSecurityConstraints
       * </p>
       *
       * @param constraints security constraints for resource
       */
      void setSecurityConstraints(List constraints);
  }
  
  
  
  1.10      +33 -1     
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
  
  Index: PageManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PageManager.java  15 Oct 2004 22:58:43 -0000      1.9
  +++ PageManager.java  19 Nov 2004 03:07:02 -0000      1.10
  @@ -24,6 +24,7 @@
   import org.apache.jetspeed.om.page.Fragment;
   import org.apache.jetspeed.om.page.Link;
   import org.apache.jetspeed.om.page.Page;
  +import org.apache.jetspeed.om.page.PageSecurity;
   import org.apache.jetspeed.om.page.Property;
   import org.apache.jetspeed.page.document.DocumentException;
   import org.apache.jetspeed.page.document.DocumentNotFoundException;
  @@ -43,6 +44,24 @@
       public String SERVICE_NAME = "PageManager";
       
       /**
  +     * <p>
  +     * getConstraintsEnabled
  +     * </p>
  +     *
  +     * @return enabled indicator
  +     */
  +    public boolean getConstraintsEnabled();
  +
  +    /**
  +     * <p>
  +     * getPermissionsEnabled
  +     * </p>
  +     *
  +     * @return enabled indicator
  +     */
  +    public boolean getPermissionsEnabled();
  +
  +    /**
        * Creates a new empty Page instance
        *
        * @return a newly created Page object
  @@ -104,6 +123,19 @@
       * @throws NodeException
       */
       public DocumentSet getDocumentSet(String name) throws 
DocumentNotFoundException, UnsupportedDocumentTypeException, 
FolderNotFoundException, NodeException;
  +    
  +   /**
  +    * 
  +    * <p>
  +    * getPageSecurity
  +    * </p>
  +    *
  +    * Returns the PageSecurity document
  +    *
  +    * @throws PageNotFoundException if the page cannot be found
  +    * @throws NodeException
  +    */
  +    public PageSecurity getPageSecurity() throws DocumentNotFoundException, 
UnsupportedDocumentTypeException, FolderNotFoundException, NodeException;
       
       /**
        * 
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to