Package java.security.acl
Interface Acl
- All Superinterfaces:
Owner
public interface Acl extends Owner
The Access Control List (ACL) interface definition.
An ACL is a set of AclEntry objects.
An AclEntry is a list of Permissions that are granted
(positive) or denied
(negative) to a Principal.
An Acl has a list of owners (Owner) which are principals as
well Principal. Only those principals which are the Acl's
owners are allowed to modify the
Acl.
The ACL has to conform to the following rules:
- For each
Principalthere can be only one positive and one negativeAclEntry. - If the two
AclEntry's (positive and negative) for a specificPrincipalgrant and deny the samePermissionto thatPrincipal, then thatPermissionis treated as neither granted nor denied to thatPrincipal. - Permissions associated with an individual
Principalalways override permissions of the group(s) to which the individual belongs. - If there is no
AclEntryassociated with a specificPrincipal, then it is interpreted as an empty list of permissions.
-
Method Summary
Modifier and Type Method Description booleanaddEntry(Principal caller, AclEntry entry)Adds anAclEntryto this ACL instance.booleancheckPermission(Principal principal, Permission permission)Checks whether the specified principal is granted the specified permission.Enumeration<AclEntry>entries()Returns anEnumerationof theAclEntryof this ACL.StringgetName()Returns the name of this ACL instance.Enumeration<Permission>getPermissions(Principal user)Returns the set of allowed permissions for the specifiedPrincipal.booleanremoveEntry(Principal caller, AclEntry entry)Removes anAclEntryfrom this ACL instance.voidsetName(Principal caller, String name)Sets the name of this ACL instance.StringtoString()Returns the string representation of this ACL.Methods inherited from interface java.security.acl.Owner
addOwner, deleteOwner, isOwner
-
Method Details
-
setName
Sets the name of this ACL instance.- Parameters:
caller- the invokingPrincipal.name- the name to be set.- Throws:
NotOwnerException- if the invokingPrincipalis not an owner of this ACL.
-
getName
String getName()Returns the name of this ACL instance.- Returns:
- the name of this ACL instance.
-
addEntry
Adds anAclEntryto this ACL instance.If the ACL already has an
AclEntryof the same type ( positive or negative) and principal, then the new entry is not added.- Parameters:
caller- the invokingPrincipal.entry- the ACL entry to add.- Returns:
trueif the entry is added,falseif there is already an entry of the same type for the same principal- Throws:
NotOwnerException- if the invokingPrincipalis not an owner of this ACL.
-
removeEntry
Removes anAclEntryfrom this ACL instance.- Parameters:
caller- the invokingPrincipal.entry- the ACL entry to remove.- Returns:
trueif the entry is removed,falseif the entry is not in this ACL.- Throws:
NotOwnerException- if the invokingPrincipalis not an owner of this ACL.
-
getPermissions
Returns the set of allowed permissions for the specifiedPrincipal.If the specified principal has no entry in this ACL, an empty set is returned.
The allowed permissions are collected according to the following rules:
- The two permission lists (positive and negative) of the
principal's groups (
Group) are collected. The positive (granted) permissions are the union of all group's positive permissions that the principal belongs to, the negative (denied) permissions are the union of all group's negative permissions that the principal belongs to. If a specific permission is in both the positive and the negative list, it is removed from both lists. - The individual permissions (positive and negative) of the principal override the group permissions. The positive individual permissions override the group's negative permissions and the negative individual permissions override the grpup's positive permissions.
- Parameters:
user- the principal to get the allowed permissions for.- Returns:
- the set of allowed permissions for the specified principal.
- The two permission lists (positive and negative) of the
principal's groups (
-
entries
Enumeration<AclEntry> entries()Returns anEnumerationof theAclEntryof this ACL.- Returns:
- an
Enumerationof theAclEntryof this ACL.
-
checkPermission
Checks whether the specified principal is granted the specified permission.The list of granted permissions is determined according to the rules specified by
getPermissions.- Parameters:
principal- the principal the check the permissions for.permission- the permission to check for the principal.- Returns:
trueif the principal is granted the permission, otherwisefalse.- See Also:
getPermissions(Principal)
-
toString
String toString()Returns the string representation of this ACL.
-