org.locomotive.loco.perm
Class AccessControlList

java.lang.Object
  |
  +--org.locomotive.loco.perm.AccessControlList

public class AccessControlList
extends java.lang.Object
implements java.io.Serializable

Defines permission ACLs. An ACL consists of a list of permissions. Each permission in the ACL has a polarity, a list of users, and a list of groups. Polarity determines whether that permission has an allow or deny list. Therefore the list of users and the list of groups associated with the permission are allowed access to that permission if it has positive polarity, or are denied that permission if that permission has negative polarity.

See Also:
Serialized Form

Constructor Summary
AccessControlList(int ownerId)
          Creates an ACL for an object with owner id.
 
Method Summary
 void addGroup(java.lang.String groupName, java.lang.String permName)
          Adds a group to a particular permission in the ACL.
 void addPermission(java.lang.String permName)
          Adds a permission to the ACL.
 void addUser(java.lang.String userName, java.lang.String permName)
          Adds a user corresponding to a permission in the ACL.
 java.util.Vector getGroups(java.lang.String permName)
          Returns a Vector of group names associated with a particular permission
 int getId()
          Returns the owner id of the ACL.
 java.util.Vector getPermissions()
          Returns a Vector containing all of the permission names contained in the ACL.
 boolean getPolarity(java.lang.String permName)
          Gets the polarity value of a permission in the ACL.
 java.util.Vector getUsers(java.lang.String permName)
          Returns a Vector containing the user names associated with a particular permission.
 void removeGroup(java.lang.String groupName, java.lang.String permName)
          Removes a group from a particular permission in the ACL.
 void removePermission(java.lang.String permName)
          Removes a permission from the ACL.
 void removeUser(java.lang.String userName, java.lang.String permName)
          Removes a user corresponding to a permission in the ACL.
 void setPolarity(boolean pol, java.lang.String permName)
          Sets the polarity (allow or deny list) of a permission in the ACL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccessControlList

public AccessControlList(int ownerId)
Creates an ACL for an object with owner id.
Parameters:
ownerId - id of the object to which the ACL is attached
Method Detail

getId

public int getId()
Returns the owner id of the ACL.
Returns:
int owner id of the ACL

addPermission

public void addPermission(java.lang.String permName)
Adds a permission to the ACL.
Parameters:
permName - name of the permission being added to the ACL

removePermission

public void removePermission(java.lang.String permName)
Removes a permission from the ACL.
Parameters:
permName - name of the permission to be removed from the ACL.

getPermissions

public java.util.Vector getPermissions()
Returns a Vector containing all of the permission names contained in the ACL.
Returns:
Vector of all permission names contained in the ACL

addUser

public void addUser(java.lang.String userName,
                    java.lang.String permName)
Adds a user corresponding to a permission in the ACL.
Parameters:
userName - name of the user to be added
permName - name of the permission to which the user is being added

removeUser

public void removeUser(java.lang.String userName,
                       java.lang.String permName)
Removes a user corresponding to a permission in the ACL.
Parameters:
userName - name of the user to be removed
permName - name of the permission from which the user is being removed

getUsers

public java.util.Vector getUsers(java.lang.String permName)
Returns a Vector containing the user names associated with a particular permission.
Parameters:
permName - name of the permission
Returns:
Vector of String user names

addGroup

public void addGroup(java.lang.String groupName,
                     java.lang.String permName)
Adds a group to a particular permission in the ACL.
Parameters:
groupName - name of group to be added
permName - name of the permission to which the group is being added

removeGroup

public void removeGroup(java.lang.String groupName,
                        java.lang.String permName)
Removes a group from a particular permission in the ACL.
Parameters:
groupName - name of the group to be removed
permName - name of the permission from which the group is being removed

getGroups

public java.util.Vector getGroups(java.lang.String permName)
Returns a Vector of group names associated with a particular permission
Parameters:
permName - name of the permission
Returns:
Vector of String group names

setPolarity

public void setPolarity(boolean pol,
                        java.lang.String permName)
Sets the polarity (allow or deny list) of a permission in the ACL.
Parameters:
pol - boolean polarity value
permName - permission of the ACL whose polarity is being set

getPolarity

public boolean getPolarity(java.lang.String permName)
Gets the polarity value of a permission in the ACL.
Parameters:
permName - name of the permission whose polarity is in question
Returns:
boolean polarity value