KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > service > cmr > security > 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.service.cmr.security;
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 Andy Hind
30  */

31 public interface PermissionService
32 {
33     public static final String JavaDoc ROLE_PREFIX = "ROLE_";
34     
35     public static final String JavaDoc GROUP_PREFIX = "GROUP_";
36     
37     
38     
39     public static final String JavaDoc ALL_AUTHORITIES = "GROUP_EVERYONE";
40
41     public static final String JavaDoc OWNER_AUTHORITY = "ROLE_OWNER";
42     
43     public static final String JavaDoc LOCK_OWNER_AUTHORITY = "ROLE_LOCK_OWNER";
44     
45     public static final String JavaDoc ADMINISTRATOR_AUTHORITY = "ROLE_ADMINISTRATOR";
46
47     public static final String JavaDoc GUEST_AUTHORITY = "guest";
48     
49     
50     
51     public static final String JavaDoc ALL_PERMISSIONS = "All";
52     
53     public static final String JavaDoc FULL_CONTROL = "FullControl";
54
55     public static final String JavaDoc READ = "Read";
56
57     public static final String JavaDoc WRITE = "Write";
58
59     public static final String JavaDoc DELETE = "Delete";
60
61     public static final String JavaDoc ADD_CHILDREN = "AddChildren";
62
63     public static final String JavaDoc READ_PROPERTIES = "ReadProperties";
64
65     public static final String JavaDoc READ_CHILDREN = "ReadChildren";
66
67     public static final String JavaDoc WRITE_PROPERTIES = "WriteProperties";
68
69     public static final String JavaDoc DELETE_NODE = "DeleteNode";
70
71     public static final String JavaDoc DELETE_CHILDREN = "DeleteChildren";
72
73     public static final String JavaDoc CREATE_CHILDREN = "CreateChildren";
74
75     public static final String JavaDoc LINK_CHILDREN = "LinkChildren";
76
77     public static final String JavaDoc DELETE_ASSOCIATIONS = "DeleteAssociations";
78
79     public static final String JavaDoc READ_ASSOCIATIONS = "ReadAssociations";
80
81     public static final String JavaDoc CREATE_ASSOCIATIONS = "CreateAssociations";
82
83     public static final String JavaDoc READ_PERMISSIONS = "ReadPermissions";
84
85     public static final String JavaDoc CHANGE_PERMISSIONS = "ChangePermissions";
86
87     public static final String JavaDoc EXECUTE = "Execute";
88
89     public static final String JavaDoc READ_CONTENT = "ReadContent";
90
91     public static final String JavaDoc WRITE_CONTENT = "WriteContent";
92
93     public static final String JavaDoc EXECUTE_CONTENT = "ExecuteContent";
94
95     public static final String JavaDoc TAKE_OWNERSHIP = "TakeOwnership";
96
97     public static final String JavaDoc SET_OWNER = "SetOwner";
98
99     public static final String JavaDoc COORDINATOR = "Coordinator";
100
101     public static final String JavaDoc CONTRIBUTOR = "Contributor";
102
103     public static final String JavaDoc EDITOR = "Editor";
104
105     public static final String JavaDoc CONSUMER = "Consumer";
106     
107     public static final String JavaDoc LOCK = "Lock";
108     
109     public static final String JavaDoc UNLOCK = "Unlock";
110     
111     public static final String JavaDoc CHECK_OUT = "CheckOut";
112     
113     public static final String JavaDoc CHECK_IN = "CheckIn";
114     
115     public static final String JavaDoc CANCEL_CHECK_OUT = "CancelCheckOut";
116
117     /**
118      * Get the Owner Authority
119      *
120      * @return the owner authority
121      */

122     public String JavaDoc getOwnerAuthority();
123
124     /**
125      * Get the All Authorities
126      *
127      * @return the All authorities
128      */

129     public String JavaDoc getAllAuthorities();
130
131     /**
132      * Get the All Permission
133      *
134      * @return the All permission
135      */

136     public String JavaDoc getAllPermission();
137
138     /**
139      * Get all the AccessPermissions that are granted/denied to the current
140      * authentication for the given node
141      *
142      * @param nodeRef -
143      * the reference to the node
144      * @return the set of allowed permissions
145      */

146     public Set JavaDoc<AccessPermission> getPermissions(NodeRef nodeRef);
147
148     /**
149      * Get all the AccessPermissions that are set for anyone for the
150      * given node
151      *
152      * @param nodeRef -
153      * the reference to the node
154      * @return the set of allowed permissions
155      */

156     public Set JavaDoc<AccessPermission> getAllSetPermissions(NodeRef nodeRef);
157
158     /**
159      * Get the permissions that can be set for a given node
160      *
161      * @param nodeRef
162      * @return
163      */

164     public Set JavaDoc<String JavaDoc> getSettablePermissions(NodeRef nodeRef);
165
166     /**
167      * Get the permissions that can be set for a given type
168      *
169      * @param nodeRef
170      * @return
171      */

172     public Set JavaDoc<String JavaDoc> getSettablePermissions(QName type);
173
174     /**
175      * Check that the given authentication has a particular permission for the
176      * given node. (The default behaviour is to inherit permissions)
177      *
178      * @param nodeRef
179      * @param perm
180      * @return
181      */

182     public AccessStatus hasPermission(NodeRef nodeRef, String JavaDoc perm);
183
184     /**
185      * Delete all the permission assigned to the node
186      *
187      * @param nodeRef
188      */

189     public void deletePermissions(NodeRef nodeRef);
190
191     /**
192      * Delete all permission for the given authority.
193      *
194      * @param nodeRef
195      * @param authority
196      */

197     public void clearPermission(NodeRef nodeRef, String JavaDoc authority);
198     
199     /**
200      * Find and delete a permission by node, authentication and permission
201      * definition.
202      *
203      * @param nodeRef
204      * @param authority
205      * @param perm
206      */

207     public void deletePermission(NodeRef nodeRef, String JavaDoc authority, String JavaDoc perm, boolean allow);
208
209     /**
210      * Set a specific permission on a node.
211      *
212      * @param nodeRef
213      * @param authority
214      * @param perm
215      * @param allow
216      */

217     public void setPermission(NodeRef nodeRef, String JavaDoc authority, String JavaDoc perm, boolean allow);
218
219     /**
220      * Set the global inheritance behaviour for permissions on a node.
221      *
222      * @param nodeRef
223      * @param inheritParentPermissions
224      */

225     public void setInheritParentPermissions(NodeRef nodeRef, boolean inheritParentPermissions);
226     
227     /**
228      * Return the global inheritance behaviour for permissions on a node.
229      *
230      * @param nodeRef
231      * @return inheritParentPermissions
232      */

233     public boolean getInheritParentPermissions(NodeRef nodeRef);
234 }
235
Popular Tags