incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r164130 - in /incubator/graffito/trunk/api: project.xml src/java/org/apache/portals/graffito/ContentPermissionService.java src/java/org/apache/portals/graffito/model/CmsPermission.java
Date Thu, 21 Apr 2005 22:00:34 GMT
Author: clombart
Date: Thu Apr 21 15:00:34 2005
New Revision: 164130

URL: http://svn.apache.org/viewcvs?rev=164130&view=rev
Log:
Add new service : ContentPermissionService which extend the J2 perm service.
By this way, admin portlets can grant & revoke permissions

Added:
    incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/ContentPermissionService.java
    incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/model/CmsPermission.java
Modified:
    incubator/graffito/trunk/api/project.xml

Modified: incubator/graffito/trunk/api/project.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/api/project.xml?rev=164130&r1=164129&r2=164130&view=diff
==============================================================================
--- incubator/graffito/trunk/api/project.xml (original)
+++ incubator/graffito/trunk/api/project.xml Thu Apr 21 15:00:34 2005
@@ -4,7 +4,7 @@
     <connection>scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/api</connection>
     <developerConnection>scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/api</developerConnection>
     <url>http://svn.apache.org/viewcvs</url>
-  </repository>
  
  <dependencies>
  </dependencies>
  <build>
   <sourceDirectory>src/java</sourceDirectory>
     <resources>
      <resource>
       <directory>${basedir}/src/java</directory>
        <excludes>
  
       <exclude>**/*.java</exclude>
        </excludes>
      </resource>
   </resources>
    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
   <unitTest>
       <includes>
        <include>**/Test*.java</include>
     </includes>
      <excludes>
      </excludes>
      <resources>
       <resource>
          <directory>${basedir}/src/test</directory>
         <excludes>
          <exclude>**/*.java</exclude>
          </excludes>
       </resource>
      </resources>
    </unitTest>
    
  </build>
 <reports>
+  </repository>
  
  <dependencies>
    <dependency>
      <id>jetspeed-api</id>
     <groupId>jetspeed2</groupId>
      <version>2.0-M3-dev</version>
   </dependency>
	
  </dependencies>
  <build>
    <sourceDirectory>src/java</sourceDirectory>
    <resources>
      <resource>
        <directory>${basedir}/src/java</directory>
       <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
     </resource>
    </resources>
    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
   <unitTest>
       <includes>
        <include>**/Test*.java</include>
     </includes>
      <excludes>
      </excludes>
      <resources>
       <resource>
          <directory>${basedir}/src/test</directory>
         <excludes>
          <exclude>**/*.java</exclude>
          </excludes>
       </resource>
      </resources>
    </unitTest>
    
  </build>
 <reports>
        <report>maven-javadoc-plugin</report>
   </reports>
     

Added: incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/ContentPermissionService.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/ContentPermissionService.java?rev=164130&view=auto
==============================================================================
--- incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/ContentPermissionService.java
(added)
+++ incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/ContentPermissionService.java
Thu Apr 21 15:00:34 2005
@@ -0,0 +1,67 @@
+/* Copyright 2004 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.portals.graffito;
+
+import java.security.Permissions;
+
+import org.apache.jetspeed.security.PermissionManager;
+import org.apache.portals.graffito.exception.ContentManagementException;
+import org.apache.portals.graffito.model.CmsObject;
+import org.apache.portals.graffito.model.CmsPermission;
+
+
+
+/**
+ * Extends the Jetspeed 2 Permission manager in order to manager permission on cms objects
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe
</a>
+ * @version $Id: Exp $
+ */
+public interface ContentPermissionService extends PermissionManager
+{
+
+    /**
+     * Factory to create a new cms permission object.
+     * 
+     * @param name the permission name
+     * @param actions The authorised actions
+     * @return an empty factory created permission.
+     * @throws ContentManagementException
+     */
+    public CmsPermission createPermission(String name, String actions) throws ContentManagementException;
+    
+    /**
+     * Get all permissions defined for a cms objects
+     * @param cmsObject the cms object 
+     * @return the permissions found
+     */
+    Permissions getPermissions(CmsObject cmsObject);
+
+    /**
+     * Get all permissions defined for a cms objects
+     * @param uri the cms object uri
+     * @return the permissions found
+     */   
+    Permissions getPermissions(String uri);    
+
+    /**
+     * Grant a CmsPermission to a principal
+     * @param principalFullPath the principal full path (eg. /roles/admin)
+     * @param permission The permission to set 
+     * @throws ContentManagementException
+     */    
+    public void grantPermission(String principalFullPath, CmsPermission permission) throws
ContentManagementException;
+
+}
\ No newline at end of file

Added: incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/model/CmsPermission.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/model/CmsPermission.java?rev=164130&view=auto
==============================================================================
--- incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/model/CmsPermission.java
(added)
+++ incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/model/CmsPermission.java
Thu Apr 21 15:00:34 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2000-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.portals.graffito.model;
+
+import java.util.Collection;
+
+/**
+ * Permission apply to a cms object like view, update, delete, ... 
+ * The permission can be apply :
+ * 	- Only on the cms object itself
+ *  - on the object and its children
+ *  - Recursively on all children and subfolders   
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe
</a>
+ * @version $Id: Exp $
+ */
+public interface CmsPermission 
+{
+    
+    /** View a cms object */
+    static public final String VIEW = "view";
+    /** Edit a cms object */    
+    static public final String EDIT = "edit";
+    /** Lock a cms object */
+    static public final String LOCK = "lock";
+    /** Unlock a cms object */
+    static public final String UNLOCK = "unlock";
+    /** Delete a cms object */
+    static public final String DELETE = "delete";
+    /** Insert a cms object */
+    static public final String INSERT = "insert";
+    /** Update a cms object */
+    static public final String UPDATE = "update";    
+    /** All action authorized on a cms object */
+    static public final String ALL = "all";    
+
+    /**
+     * Get the permission name. 
+     * The name match to the cms object uri. 
+     * The name contains an "*" if this permission has to be apply on children
+     * The name contains an "-" if this permission has to be apply recusively
+     * @return The permission name
+     */
+    public String getName();
+    
+    /**
+     * Get the action allowed by this permission (view, delete, ...)
+     * "all" can be used to apply all permission on the cms object
+     * @return the allowed actions
+     */
+    public String getActions();
+    
+    
+    /**
+     * Get all principals assigned to this permissions 
+     * @return the the principal full paths (eg. /users/christophe, /groups/admin, ...)
+     */
+    public Collection getPrincipalFullPaths();
+    
+    /**
+     * Check if the permission is applying recursivly on all subfolder
+     * 
+     */
+    public boolean isRecursive();
+    
+    public boolean isApplyToChildren();
+    
+}



Mime
View raw message