KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lucane > server > acl > AccessController


1 /*
2  * Lucane - a collaborative platform
3  * Copyright (C) 2004 Vincent Fiack <vfiack@mail15.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package org.lucane.server.acl;
20
21 import org.lucane.common.acl.AclInfo;
22 import org.lucane.server.ServerConfig;
23
24 public abstract class AccessController
25 {
26     //-- factory
27

28     public static AccessController newInstance(ServerConfig config)
29     throws Exception JavaDoc
30     {
31         return new DefaultAccessController();
32     }
33     
34     //-- interface : add ACL
35

36     /**
37      * Allow access to an item for a user
38      */

39     public abstract void allowUser(String JavaDoc appName, String JavaDoc item, String JavaDoc access, String JavaDoc user) throws Exception JavaDoc;
40     
41     /**
42      * Allow access to an item for a group
43      */

44     public abstract void allowGroup(String JavaDoc appName, String JavaDoc item, String JavaDoc access, String JavaDoc group) throws Exception JavaDoc;
45     
46     /**
47      * Deny access to an item for a user
48      */

49     public abstract void denyUser(String JavaDoc appName, String JavaDoc item, String JavaDoc access, String JavaDoc user) throws Exception JavaDoc;
50
51     /**
52      * Deny access to an item for a group
53      */

54     public abstract void denyGroup(String JavaDoc appName, String JavaDoc item, String JavaDoc access, String JavaDoc group) throws Exception JavaDoc;
55
56     //-- interface : remove ACL
57

58     /**
59      * Remove access information for a user on an item
60      */

61     public abstract void removeAclForUser(String JavaDoc appName, String JavaDoc item, String JavaDoc access, String JavaDoc user) throws Exception JavaDoc;
62     
63     /**
64      * Remove access information for a group on an item
65      */

66     public abstract void removeAclForGroup(String JavaDoc appName, String JavaDoc item, String JavaDoc access, String JavaDoc group) throws Exception JavaDoc;
67     
68     //-- interface : read ACL
69

70     /**
71      * Get all ACLS for a specific item
72      */

73     public abstract AclInfo[] getAcls(String JavaDoc appName, String JavaDoc item) throws Exception JavaDoc;
74     
75     /**
76      * Get all accesses for a user on an item
77      */

78     public abstract String JavaDoc[] getAccesses(String JavaDoc appName, String JavaDoc item, String JavaDoc user) throws Exception JavaDoc;
79
80     /**
81      * Check if a user has a specific access on an item
82      */

83     public abstract boolean hasAccess(String JavaDoc appName, String JavaDoc item, String JavaDoc access, String JavaDoc user) throws Exception JavaDoc;
84
85     //-- interface : remove ACL elements
86

87     /**
88      * Remove an item and all linked ACLs
89      */

90     public abstract void removeItem(String JavaDoc appName, String JavaDoc item) throws Exception JavaDoc;
91
92     /**
93      * Remove an user and all linked ACLs
94      */

95     public abstract void removeUser(String JavaDoc user) throws Exception JavaDoc;
96     
97     
98     /**
99      * Remove an application and all linked ACLs
100      */

101     public abstract void removeApplication(String JavaDoc appName) throws Exception JavaDoc;
102
103     /**
104      * Remove a group and all linked ACLs
105      */

106     public abstract void removeGroup(String JavaDoc group) throws Exception JavaDoc;
107 }
Popular Tags