You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@apache.org on 2002/06/30 21:53:40 UTC

cvs commit: xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl SlideSource.java

stephan     2002/06/30 12:53:40

  Modified:    src/scratchpad/src/org/apache/cocoon/components/source
                        RestrictableSource.java
               src/scratchpad/src/org/apache/cocoon/components/source/helpers
                        SourcePermission.java
               src/scratchpad/src/org/apache/cocoon/components/source/impl
                        SlideSource.java
  Log:
  Modified the SourcePermission helper.
  Added a well sorted list of privileges similar to
  the privileges for WebDAV resources.
  
  Revision  Changes    Path
  1.3       +7 -7      xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/RestrictableSource.java
  
  Index: RestrictableSource.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/RestrictableSource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RestrictableSource.java	24 Jun 2002 16:26:14 -0000	1.2
  +++ RestrictableSource.java	30 Jun 2002 19:53:40 -0000	1.3
  @@ -79,19 +79,19 @@
       public void setSourceCredential(SourceCredential sourcecredential) throws SourceException;
   
       /*
  -     * Add a permission to this source
  +     * Set a permission to this source
        *
  -     * @param sourcepermission Permission, which should be added
  +     * @param sourcepermission Permission, which should be set
        *
        * @throws SourceException If an exception occurs during this operation
        *
  -    public void addSourcePermission(SourcePermission sourcepermission) throws SourceException;
  +    public void setSourcePermission(SourcePermission sourcepermission) throws SourceException;
   
       /*
  -     * Returns a enumeration of the existing locks
  +     * Returns a list of the existing permissions
        *
  -     * @return Enumeration of SourcePermission
  +     * @return Array of SourcePermission
        *
  -    public Enumeration getSourcePermissions() throws SourceException;*/
  +    public SourcePermission[] getSourcePermissions() throws SourceException;*/
   }
   
  
  
  
  1.2       +58 -25    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/SourcePermission.java
  
  Index: SourcePermission.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/SourcePermission.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SourcePermission.java	21 Jun 2002 13:39:43 -0000	1.1
  +++ SourcePermission.java	30 Jun 2002 19:53:40 -0000	1.2
  @@ -58,65 +58,98 @@
   /**
    * This class represents a permission for a source
    *
  - * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
  + * @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
    * @version $Id$
    */
   public class SourcePermission {
   
  -    private String  subject;
  -    private String  action;
  +    public final static String PRINCIPAL_SELF              = "self";
  +    public final static String PRINCIPAL_ALL               = "all";
  +    public final static String PRINCIPAL_GUEST             = "guest";
  +
  +    public final static String PRIVILEGE_ALL               = "all";
  +    public final static String PRIVILEGE_READ              = "read";
  +    public final static String PRIVILEGE_WRITE             = "write";
  +
  +    //public final static String PRIVILEGE_READ_ACL          = "read-acl";
  +    //public final static String PRIVILEGE_WRITE_ACL         = "write-acl";
  +
  +    public final static String PRIVILEGE_READ_SOURCE       = "read-source";
  +    public final static String PRIVILEGE_CREATE_SOURCE     = "create-source";
  +    public final static String PRIVILEGE_REMOVE_SOURCE     = "remove-source";
  +
  +    public final static String PRIVILEGE_LOCK_SOURCE       = "lock-source";
  +    public final static String PRIVILEGE_READ_LOCKS        = "read-locks";
  +
  +    public final static String PRIVILEGE_READ_PROPERTY     = "read-property";
  +    public final static String PRIVILEGE_CREATE_PROPERTY   = "create-property";
  +    public final static String PRIVILEGE_MODIFY_PROPERTY   = "modify-property";
  +    public final static String PRIVILEGE_REMOVE_PROPERTY   = "remove-property";
  +
  +    public final static String PRIVILEGE_READ_CONTENT      = "read-content";
  +    public final static String PRIVILEGE_CREATE_CONTENT    = "create-content";
  +    public final static String PRIVILEGE_MODIFY_CONTENT    = "modify-content";
  +    public final static String PRIVILEGE_REMOVE_CONTENT    = "remove-content";
  +
  +    public final static String PRIVILEGE_GRANT_PERMISSION  = "grant-permission";
  +    public final static String PRIVILEGE_REVOKE_PERMISSION = "revoke-permission";
  +
  +    private String  principal;
  +    private String  privilege;
       private boolean inheritable;
       private boolean negative;
   
       /**
        * Creates a new permission
        *
  -     * @param subject Subject of the permission
  +     * @param principal Principal of the permission
  +     * @param privilege Privilege of the permission
        * @param inheritable If the permission is inheritable
        * @param negative If the permission is negative
        */
  -    public SourcePermission(String subject, String action, 
  +    public SourcePermission(String principal, String privilege, 
                               boolean inheritable, boolean negative) {
   
  -        this.subject     = subject;
  +        this.principal   = principal;
  +        this.privilege   = privilege;
           this.inheritable = inheritable;
           this.negative    = negative;
       }
   
       /**
  -     * Sets the subject of the permission
  +     * Sets the principal of the permission
        *
  -     * @param subject Subject of the permission
  +     * @param principal Principal of the permission
        */
  -    public void setSubject(String subject) {
  -        this.subject = subject;
  +    public void setPrincipal(String principal) {
  +        this.principal   = principal;
       }
   
       /**
  -     * Returns the subject of the permission
  +     * Returns the principal of the permission
        * 
  -     * @return Subject of the permission
  +     * @return Principal of the permission
        */
  -    public String getSubject() {
  -        return this.subject;
  +    public String getPrincipal() {
  +        return this.principal;
       }
   
       /**
  -     * Sets the action of the permission
  +     * Sets the privilege of the permission
        *
  -     * @param action Action of the permission
  +     * @param privilege Privilege of the permission
        */
  -    public void setAction(String action) {
  -        this.action = action;
  +    public void setPrivilege(String privilege) {
  +        this.privilege   = privilege;
       }
   
       /**
  -     * Returns the action of the permission
  +     * Returns the privilege of the permission
        * 
  -     * @return Action of the permission
  +     * @return Privilege of the permission
        */
  -    public String getAction() {
  -        return this.action;
  +    public String getPrivilege() {
  +        return this.privilege;
       }
   
       /**
  @@ -140,7 +173,7 @@
       /**
        * Sets the negative flag
        *
  -     * @param negative If the permission is negative
  +     * @param negative If the permission is a negative permission
        */
       public void setNegative(boolean negative) {
           this.negative = negative;
  @@ -149,7 +182,7 @@
       /**
        * Returns the negative flag
        * 
  -     * @return If the permission is negative
  +     * @return If the permission is a negative permission
        */
       public boolean isNegative() {
           return this.negative;
  
  
  
  1.6       +16 -14    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java
  
  Index: SlideSource.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SlideSource.java	27 Jun 2002 16:53:37 -0000	1.5
  +++ SlideSource.java	30 Jun 2002 19:53:40 -0000	1.6
  @@ -643,13 +643,13 @@
       }
   
       /**
  -     * Add a permission to this source
  +     * Set a permission to this source
        *
  -     * @param sourcepermission Permission, which should be added
  +     * @param sourcepermission Permission, which should be set
        *
        * @throws SourceException If an exception occurs during this operation
  -     */
  -    public void addSourcePermission(SourcePermission sourcepermission) throws SourceException {
  +     **/
  +    public void setSourcePermission(SourcePermission sourcepermission) throws SourceException {
           /*NodePermission permission = 
               new NodePermission(this.uri, sourcepermission.getSubject(), action, 
                                  sourcepermission.isInheritable(),
  @@ -660,16 +660,16 @@
       }
   
       /**
  -     * Returns a enumeration of the existing locks
  +     * Returns a list of the existing permissions
        *
  -     * @return Enumeration of SourcePermission
  -     */
  -    public Enumeration getSourcePermissions() throws SourceException {
  -        try {
  +     * @return Array of SourcePermission
  +     **/
  +    public SourcePermission[] getSourcePermissions() throws SourceException {
  +        /*try {
               Vector sourcepermissions = new Vector();
   
               NodePermission permission;
  -            for(Enumeration permissions = this.lock.enumerateLocks(this.slideToken, this.uri);
  +            for(Enumeration permissions = this.security.enumeratePermissions(this.slideToken, this.uri);
                   permissions.hasMoreElements();) {
   
                   permission = (NodePermission) permissions.nextElement();
  @@ -682,8 +682,10 @@
   
               return sourcepermissions.elements();
           } catch (SlideException se) {
  -            throw new SourceException("Could not remove property", se);
  -        }
  +            throw new SourceException("Could not retrieve permissions", se);
  +        }*/
  +
  +        throw new SourceException("Operation not yet supported");
       }
   
       /**
  @@ -721,7 +723,7 @@
   
               return sourcelocks.elements();
           } catch (SlideException se) {
  -            throw new SourceException("Could not remove property", se);
  +            throw new SourceException("Could not retrieve locks", se);
           }
       }
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org