View Javadoc

1   /* Copyright 2004 Apache Software Foundation
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.apache.portals.graffito;
16  
17  import java.security.Permissions;
18  
19  import org.apache.jetspeed.security.PermissionManager;
20  import org.apache.portals.graffito.exception.ContentManagementException;
21  import org.apache.portals.graffito.model.CmsObject;
22  import org.apache.portals.graffito.model.CmsPermission;
23  
24  
25  
26  /***
27   * Extends the Jetspeed 2 Permission manager in order to manager permission on cms objects
28   *
29   * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
30   * @version $Id: Exp $
31   */
32  public interface ContentPermissionService extends PermissionManager
33  {
34  
35      /***
36       * Factory to create a new cms permission object.
37       * 
38       * @param name the permission name
39       * @param actions The authorised actions
40       * @return an empty factory created permission.
41       * @throws ContentManagementException
42       */
43      public CmsPermission createPermission(String name, String actions) throws ContentManagementException;
44      
45      /***
46       * Get all permissions defined for a cms objects
47       * @param cmsObject the cms object 
48       * @return the permissions found
49       */
50      Permissions getPermissions(CmsObject cmsObject);
51  
52      /***
53       * Get all permissions defined for a cms objects
54       * @param uri the cms object uri
55       * @return the permissions found
56       */   
57      Permissions getPermissions(String uri);    
58  
59      /***
60       * Grant a CmsPermission to a principal
61       * @param principalFullPath the principal full path (eg. /roles/admin)
62       * @param permission The permission to set 
63       * @throws ContentManagementException
64       */    
65      public void grantPermission(String principalFullPath, CmsPermission permission) throws ContentManagementException;
66  
67  }