001: /*
002: * Lucane - a collaborative platform
003: * Copyright (C) 2004 Vincent Fiack <vfiack@mail15.com>
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */
019: package org.lucane.server.acl;
020:
021: import org.lucane.common.acl.AclInfo;
022: import org.lucane.server.ServerConfig;
023:
024: public abstract class AccessController {
025: //-- factory
026:
027: public static AccessController newInstance(ServerConfig config)
028: throws Exception {
029: return new DefaultAccessController();
030: }
031:
032: //-- interface : add ACL
033:
034: /**
035: * Allow access to an item for a user
036: */
037: public abstract void allowUser(String appName, String item,
038: String access, String user) throws Exception;
039:
040: /**
041: * Allow access to an item for a group
042: */
043: public abstract void allowGroup(String appName, String item,
044: String access, String group) throws Exception;
045:
046: /**
047: * Deny access to an item for a user
048: */
049: public abstract void denyUser(String appName, String item,
050: String access, String user) throws Exception;
051:
052: /**
053: * Deny access to an item for a group
054: */
055: public abstract void denyGroup(String appName, String item,
056: String access, String group) throws Exception;
057:
058: //-- interface : remove ACL
059:
060: /**
061: * Remove access information for a user on an item
062: */
063: public abstract void removeAclForUser(String appName, String item,
064: String access, String user) throws Exception;
065:
066: /**
067: * Remove access information for a group on an item
068: */
069: public abstract void removeAclForGroup(String appName, String item,
070: String access, String group) throws Exception;
071:
072: //-- interface : read ACL
073:
074: /**
075: * Get all ACLS for a specific item
076: */
077: public abstract AclInfo[] getAcls(String appName, String item)
078: throws Exception;
079:
080: /**
081: * Get all accesses for a user on an item
082: */
083: public abstract String[] getAccesses(String appName, String item,
084: String user) throws Exception;
085:
086: /**
087: * Check if a user has a specific access on an item
088: */
089: public abstract boolean hasAccess(String appName, String item,
090: String access, String user) throws Exception;
091:
092: //-- interface : remove ACL elements
093:
094: /**
095: * Remove an item and all linked ACLs
096: */
097: public abstract void removeItem(String appName, String item)
098: throws Exception;
099:
100: /**
101: * Remove an user and all linked ACLs
102: */
103: public abstract void removeUser(String user) throws Exception;
104:
105: /**
106: * Remove an application and all linked ACLs
107: */
108: public abstract void removeApplication(String appName)
109: throws Exception;
110:
111: /**
112: * Remove a group and all linked ACLs
113: */
114: public abstract void removeGroup(String group) throws Exception;
115: }
|