org.locomotive.loco.perm
Class ACLManager
java.lang.Object
|
+--org.locomotive.loco.perm.ACLManager
- public class ACLManager
- extends java.lang.Object
- implements java.io.Serializable
Maintains all database transactions dealing with acls.
- See Also:
- Serialized Form
Method Summary |
static void |
addACL(AccessControlList acl,
java.sql.Connection conn)
Adds an ACL to the database. |
static boolean |
exists(int id,
java.sql.Connection conn)
Checks the existence of an ACL in the database. |
static AccessControlList |
getACL(int id,
java.sql.Connection conn)
Retrieves an ACL from the database. |
static boolean |
permit(int id,
java.lang.String perm,
int userid,
java.sql.Connection conn)
Returns a boolean indicating whether a particular user, identified
by the userid, is allowed the permission in question (indicated by
its name) in the ACL specified by the id. |
static void |
removeACL(int id,
java.sql.Connection conn)
Removes an ACL from the database. |
static void |
updateACL(AccessControlList updatedACL,
java.sql.Connection conn)
Updates an ACL in the database. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
NO_USERS
public static final int NO_USERS
ACLManager
public ACLManager()
addACL
public static void addACL(AccessControlList acl,
java.sql.Connection conn)
throws java.sql.SQLException,
LoadUserException,
UserNotFoundException
- Adds an ACL to the database.
- Parameters:
acl
- ACL to be added to the databaseconn
- database connection- Throws:
- java.sql.SQLException - when a database error occurs
- LoadUserException - when a user cannot be loaded from
the database
- UserNotFoundException - when a user cannot be found in the
database
removeACL
public static void removeACL(int id,
java.sql.Connection conn)
throws java.sql.SQLException
- Removes an ACL from the database.
- Parameters:
id
- id of ACL to be removedconn
- database connection- Throws:
- java.sql.SQLException - when a database error occurs
updateACL
public static void updateACL(AccessControlList updatedACL,
java.sql.Connection conn)
throws java.sql.SQLException,
LoadUserException,
UserNotFoundException
- Updates an ACL in the database.
- Parameters:
updatedACL
- updated ACLconn
- database connection- Throws:
- java.sql.SQLException - when a database error occurs
- LoadUserException - when a user cannot be loaded from
the database
- UserNotFoundException - when a user cannot be found in the
database
getACL
public static AccessControlList getACL(int id,
java.sql.Connection conn)
throws java.sql.SQLException,
UserNotFoundException,
LoadUserException
- Retrieves an ACL from the database.
- Parameters:
id
- id of ACLconn
- database connection- Returns:
- AccessControlList object (null if ACL does not exist)
- Throws:
- java.sql.SQLException - when a database error occurs
- LoadUserException - when a user cannot be loaded from the
database
- UserNotFoundException - when a user cannot be found in the
database
exists
public static boolean exists(int id,
java.sql.Connection conn)
throws java.sql.SQLException
- Checks the existence of an ACL in the database.
- Parameters:
id
- id of the ACL in questionconn
- database connection- Returns:
true
if an ACL associated with the id exists- Throws:
- java.sql.SQLException - when a database error occurs
permit
public static boolean permit(int id,
java.lang.String perm,
int userid,
java.sql.Connection conn)
throws java.sql.SQLException
- Returns a boolean indicating whether a particular user, identified
by the userid, is allowed the permission in question (indicated by
its name) in the ACL specified by the id.
- Parameters:
id
- id of ACLperm
- name of permissionuserid
- id of userconn
- database connection- Returns:
true
if the user has the permission in the ACL- Throws:
- java.sql.SQLException - when a database error occurs