Methods Summary |
---|
public boolean | addEntry(java.security.Principal caller, java.security.acl.AclEntry entry)Adds an ACL entry to this ACL. An entry associates a principal (e.g., an individual or a group)
with a set of permissions. Each principal can have at most one positive ACL entry
(specifying permissions to be granted to the principal) and one negative ACL entry
(specifying permissions to be denied). If there is already an ACL entry
of the same type (negative or positive) already in the ACL, false is returned.
if (!isOwner(caller))
throw new NotOwnerException();
if (entryList.contains(entry))
return false;
/*
for (Enumeration e = entryList.elements();e.hasMoreElements();){
AclEntry ent = (AclEntry) e.nextElement();
if (ent.getPrincipal().equals(entry.getPrincipal()))
return false;
}
*/
entryList.addElement(entry);
return true;
|
public boolean | checkCommunity(java.lang.String community)Checks whether or not the specified community string is defined.
for (Enumeration e = entryList.elements();e.hasMoreElements();){
AclEntryImpl ent = (AclEntryImpl) e.nextElement();
if (ent.checkCommunity(community)) return true;
}
return false;
|
public boolean | checkPermission(java.security.Principal user, java.lang.String community, java.security.acl.Permission perm)Checks whether or not the specified principal has the specified
permission.
If it does, true is returned, otherwise false is returned.
More specifically, this method checks whether the passed permission
is a member of the allowed permission set of the specified principal.
The allowed permission set is determined by the same algorithm as is
used by the getPermissions method.
for (Enumeration e = entryList.elements();e.hasMoreElements();){
AclEntryImpl ent = (AclEntryImpl) e.nextElement();
if (ent.getPrincipal().equals(user))
if (ent.checkPermission(perm) && ent.checkCommunity(community)) return true;
}
return false;
|
public boolean | checkPermission(java.security.Principal user, java.security.acl.Permission perm)Checks whether or not the specified principal has the specified
permission.
If it does, true is returned, otherwise false is returned.
More specifically, this method checks whether the passed permission
is a member of the allowed permission set of the specified principal.
The allowed permission set is determined by the same algorithm as is
used by the getPermissions method.
for (Enumeration e = entryList.elements();e.hasMoreElements();){
AclEntry ent = (AclEntry) e.nextElement();
if (ent.getPrincipal().equals(user))
if (ent.checkPermission(perm)) return true;
}
return false;
|
public java.util.Enumeration | entries()Returns an enumeration of the entries in this ACL. Each element in the
enumeration is of type AclEntry.
return entryList.elements();
|
public java.lang.String | getName()Returns the name of this ACL.
return aclName;
|
public java.util.Enumeration | getPermissions(java.security.Principal user)Returns an enumeration for the set of allowed permissions for
the specified principal
(representing an entity such as an individual or a group).
This set of allowed permissions is calculated as follows:
- If there is no entry in this Access Control List for the specified
principal, an empty permission set is returned.
- Otherwise, the principal's group permission sets are determined.
(A principal can belong to one or more groups, where a group is a group
of principals, represented by the Group interface.)
Vector empty = new Vector();
for (Enumeration e = entryList.elements();e.hasMoreElements();){
AclEntry ent = (AclEntry) e.nextElement();
if (ent.getPrincipal().equals(user))
return ent.permissions();
}
return empty.elements();
|
public void | removeAll(java.security.Principal caller)Removes all ACL entries from this ACL.
if (!isOwner(caller))
throw new NotOwnerException();
entryList.removeAllElements();
|
public boolean | removeEntry(java.security.Principal caller, java.security.acl.AclEntry entry)Removes an ACL entry from this ACL.
if (!isOwner(caller))
throw new NotOwnerException();
return (entryList.removeElement(entry));
|
public void | setName(java.security.Principal caller, java.lang.String name)Sets the name of this ACL.
if (!isOwner(caller))
throw new NotOwnerException();
aclName = name;
|
public java.lang.String | toString()Returns a string representation of the ACL contents.
return ("AclImpl: "+ getName());
|