|
Compoze Software, Inc. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.compoze.security.AccessManager
This class provides the base for managing permissions for
users and groups on a particular resource. By associating
this manager with a resource, permissions can be
granted, revoked and denyied on the principal (User or Group)
level.
| Constructor Summary | |
protected |
AccessManager(User caller,
java.lang.String sName,
long id)
Constructor. |
protected |
AccessManager(User caller,
java.lang.String sName,
long id,
com.compoze.ejb.ILocator locator)
Constructor. |
| Method Summary | |
boolean |
addOwner(java.security.Principal p)
Adds an owner. |
boolean |
checkPermission(java.security.Principal principal,
java.security.acl.Permission p)
Checks whether or not the specified principal has the specified permission. |
boolean |
denyPermission(java.security.Principal principal,
java.security.acl.Permission p)
Denies the specified principal the specified permission. |
protected java.util.List |
getEntries()
Gets the entries in the underlying Acl. |
java.util.List |
getPermissions(java.security.Principal principal)
Gets a list of allowed permissions for the specified principal (representing an entity such as a user or a group). |
java.util.List |
getPrincipals(java.security.acl.Permission p)
Gets a list of principals for the specified permission. |
java.util.List |
getPrincipals(java.security.acl.Permission p,
java.lang.Class principalImplClazz)
Gets a list of principals of for the specified permission. |
boolean |
grantPermission(java.security.Principal principal,
java.security.acl.Permission p)
Grants the specified permission to the specified principal (either (user or group). |
boolean |
isOwner(java.security.Principal p)
Checks if the given principal is an owner of the ACL. |
boolean |
removeOwner(java.security.Principal p)
Deletes the specified principal from the list of owners. |
boolean |
revokePermission(java.security.Principal principal,
java.security.acl.Permission p)
Revokes a particular permission from the specified principal. |
void |
update()
Updates the access manager (saves the access manager entry). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected AccessManager(User caller,
java.lang.String sName,
long id)
throws AccessManagerException
caller - the callersName - the resource name (may not be null)id - the resource identifier
protected AccessManager(User caller,
java.lang.String sName,
long id,
com.compoze.ejb.ILocator locator)
throws AccessManagerException
caller - the callersName - the resource name (may not be null)id - the resource identifierlocator - the locator| Method Detail |
public boolean checkPermission(java.security.Principal principal,
java.security.acl.Permission p)
throws AccessManagerException
true
is returned; otherwise false is returned.
If there is no entry in this access manager for the
specified principal, false is returned.
Otherwise, if the principal is a User, the principal's
group permission sets are determined. A principal can belong to one or
more groups User.groups(), where a group is a group of principals,
represented by Group).
The set of permissions granted to the principal is then calculated using the simple rule that user permissions always override the group permissions. That is, the principal's individual negative permission set (specific denial of permissions) overrides the group positive permission set, and the principal's individual positive permission set overrides the group negative permission set.
principal - the principalp - the permission to be checked fortrue if the principal has the specified permission; false otherwiseAccessManagerException - an error occurs checking the permission
public java.util.List getPrincipals(java.security.acl.Permission p)
throws AccessManagerException
p - the permission to check forPrincipal objects specifying the principals that have the specified permissionAccessManagerException - an error occurs retrieving the list of principals
public java.util.List getPrincipals(java.security.acl.Permission p,
java.lang.Class principalImplClazz)
throws AccessManagerException
p - the permission to check forprincipalImplClazz - the principal implmentation class (may not be null and must be subclass of Principal)Principal objects specifying the principals that have the specified permissionAccessManagerException - an error occurs retrieving the list of principals
public java.util.List getPermissions(java.security.Principal principal)
throws AccessManagerException
principal - the principal whose permission set is to be returnedPermission)AccessManagerException - an error occurs retrieving the list of permissions
public boolean grantPermission(java.security.Principal principal,
java.security.acl.Permission p)
throws AccessManagerException,
java.security.acl.NotOwnerException
principal - the principalp - the permission to be settrue on success; false if an entry of the same type (positive or negative) for the same principal is already presentjava.security.acl.NotOwnerException - if the caller principal is not an owner of the access managerAccessManagerException - an error occurs granting the principal the permission
public boolean revokePermission(java.security.Principal principal,
java.security.acl.Permission p)
throws AccessManagerException,
java.security.acl.NotOwnerException
principal - the principal from which to revoke the permissionp - the permission to revoketrue on success; false if the permission is not granted to the principal- Throws:
java.security.acl.NotOwnerException - if the caller principal is not an owner of the access managerAccessManagerException - an error occurs revoking the permission
public boolean denyPermission(java.security.Principal principal,
java.security.acl.Permission p)
throws AccessManagerException,
java.security.acl.NotOwnerException
principal - the principal from which to deny the permissionp - the permission to denytrue on success; false if the permission is not denied to the principal- Throws:
AccessManagerException - an error occurs denying the permission for the principaljava.security.acl.NotOwnerException - if the caller principal is not an owner of the access managerprotected java.util.List getEntries()
AclEntry (un-modifiable)
public boolean isOwner(java.security.Principal p)
throws AccessManagerException
p - the principal to be checked to determine whether or not it is an ownertrue if the passed principal is in the list of owners; false if notAccessManagerException - an error occurs processing the request
public boolean addOwner(java.security.Principal p)
throws AccessManagerException,
java.security.acl.NotOwnerException
p - the principal that should be added to the list of ownerstrue if successful; false if owner is already an ownerjava.security.acl.NotOwnerException - if the caller principal is not an owner of the access managerAccessManagerException - an error occurs processing the request
public boolean removeOwner(java.security.Principal p)
throws AccessManagerException,
java.security.acl.NotOwnerException,
java.security.acl.LastOwnerException
true if the owner is removed; false if the owner is not part of the list of ownersjava.security.acl.NotOwnerException - the caller is not an ownerjava.security.acl.LastOwnerException - if there is only one owner left, so that removeOwner would leave the access manager owner-lessAccessManagerException - an error occurs processing the request
public void update()
throws AccessManagerException
|
Compoze Software, Inc. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||