KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > security > permissions > PermissionService


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.security.permissions;
18
19 import java.util.Set JavaDoc;
20
21 import org.alfresco.service.cmr.repository.NodeRef;
22 import org.alfresco.service.namespace.QName;
23
24 /**
25  * The public API for a permission service
26  *
27  * The implementation may be changed in the application configuration
28  *
29  * @author andyh
30  */

31 public interface PermissionService
32 {
33     /**
34      * Get the Owner Authority
35      *
36      * @return the owner authority
37      */

38     public String JavaDoc getOwnerAuthority();
39     
40     /**
41      * Get the All Authorities
42      *
43      * @return the All authorities
44      */

45     public String JavaDoc getAllAuthorities();
46     
47     /**
48      * Get the All Permission
49      *
50      * @return the All permission
51      */

52     public PermissionReference getAllPermission();
53     
54     /**
55      * Get all the AccessPermissions that are granted to the given
56      * authentication for the given node
57      *
58      * @param nodeRef -
59      * the reference to the node
60      * @return the set of allowed permissions
61      */

62     public Set JavaDoc<AccessPermission> getPermissions(NodeRef nodeRef);
63
64     /**
65      * Get all the AccessPermissions that are granted/denied to the given
66      * authentication for the given node
67      *
68      * @param nodeRef -
69      * the reference to the node
70      * @return the set of allowed permissions
71      */

72     public Set JavaDoc<AccessPermission> getAllPermissions(NodeRef nodeRef);
73
74     /**
75      * Get the permissions that can be set for a given node
76      *
77      * @param nodeRef
78      * @return
79      */

80     public Set JavaDoc<PermissionReference> getSettablePermissions(NodeRef nodeRef);
81     
82     /**
83      * Get the permissions that can be set for a given type
84      *
85      * @param nodeRef
86      * @return
87      */

88     public Set JavaDoc<PermissionReference> getSettablePermissions(QName type);
89
90     /**
91      * Get the permissions that have been set on the given node (it knows
92      * nothing of the parent permissions)
93      *
94      * @param nodeRef
95      * @return
96      */

97     public NodePermissionEntry getSetPermissions(NodeRef nodeRef);
98
99     /**
100      * Check that the given authentication has a particular permission for the
101      * given node. (The default behaviour is to inherit permissions)
102      *
103      * @param nodeRef
104      * @param perm
105      * @return
106      */

107     public boolean hasPermission(NodeRef nodeRef, PermissionReference perm);
108
109     /**
110      * Where is the permission set that controls the behaviour for the given
111      * permission for the given authentication to access the specified name.
112      *
113      * @param nodeRef
114      * @param auth
115      * @param perm
116      * @return
117      */

118     public NodePermissionEntry explainPermission(NodeRef nodeRef, PermissionReference perm);
119
120     /**
121      * Delete all the permission assigned to the node
122      * @param nodeRef
123      */

124     public void deletePermissions(NodeRef nodeRef);
125     
126     /**
127      * Delete the permissions defined by the nodePermissionEntry
128      * @param nodePermissionEntry
129      */

130     public void deletePermissions(NodePermissionEntry nodePermissionEntry);
131     
132     /**
133      * Delete a single permission entry
134      * @param permissionEntry
135      */

136     public void deletePermission(PermissionEntry permissionEntry);
137
138     /**
139      * Find and delete a permission by node, authentication and permission definition.
140      *
141      * @param nodeRef
142      * @param authority
143      * @param perm
144      */

145     public void deletePermission(NodeRef nodeRef, String JavaDoc authority, PermissionReference perm, boolean allow);
146     
147     /**
148      * Set a specific permission on a node.
149      *
150      * @param nodeRef
151      * @param authority
152      * @param perm
153      * @param allow
154      */

155     public void setPermission(NodeRef nodeRef, String JavaDoc authority, PermissionReference perm, boolean allow);
156
157     /**
158      * Add or set a permission entry on a node.
159      *
160      * @param permissionEntry
161      */

162     public void setPermission(PermissionEntry permissionEntry);
163     
164     /**
165      * Set the permissions on a node.
166      *
167      * @param nodePermissionEntry
168      */

169     public void setPermission(NodePermissionEntry nodePermissionEntry);
170
171     /**
172      * Set the global inheritance behaviour for permissions on a node.
173      *
174      * @param nodeRef
175      * @param inheritParentPermissions
176      */

177     public void setInheritParentPermissions(NodeRef nodeRef, boolean inheritParentPermissions);
178     
179     /**
180      * Get the permission reference for the given type and permission name.
181      *
182      * @param qname
183      * @param permissionName
184      * @return
185      */

186     public PermissionReference getPermissionReference(QName qname, String JavaDoc permissionName);
187 }
188
Popular Tags