com.ecyrd.jspwiki.auth.acl
Class AclImpl

java.lang.Object
  extended by com.ecyrd.jspwiki.auth.acl.AclImpl
All Implemented Interfaces:
Acl, Serializable

public class AclImpl
extends Object
implements Acl, Serializable

JSPWiki implementation of an Access Control List.

Since:
2.3
Author:
Andrew Jaquith
See Also:
Serialized Form

Constructor Summary
AclImpl()
          Constructs a new AclImpl instance.
 
Method Summary
 boolean addEntry(AclEntry entry)
          Adds an ACL entry to this ACL.
 Enumeration entries()
          Returns an enumeration of the entries in this ACL.
 Principal[] findPrincipals(Permission permission)
          Returns all Principal objects assigned a given Permission in the access control list.
 AclEntry getEntry(Principal principal)
          Returns an AclEntry for a supplied Principal, or null if the Principal does not have a matching AclEntry.
 boolean isEmpty()
          Returns true, if this Acl is empty.
 boolean removeEntry(AclEntry entry)
          Removes an ACL entry from this ACL.
 String toString()
          Returns a string representation of the contents of this Acl.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AclImpl

public AclImpl()
Constructs a new AclImpl instance.

Method Detail

findPrincipals

public Principal[] findPrincipals(Permission permission)
Returns all Principal objects assigned a given Permission in the access control list. The Principals returned are those that have been granted either the supplied permission, or a permission implied by the supplied permission. Principals are not "expanded" if they are a role or group.

Specified by:
findPrincipals in interface Acl
Parameters:
permission - the permission to search for
Returns:
an array of Principals possessing the permission

addEntry

public boolean addEntry(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. If there is already an ACL entry already in the ACL, false is returned.

Specified by:
addEntry in interface Acl
Parameters:
entry - - the ACL entry to be added to this ACL
Returns:
true on success, false if an entry of the same type (positive or negative) for the same principal is already present in this ACL

removeEntry

public boolean removeEntry(AclEntry entry)
Removes an ACL entry from this ACL.

Specified by:
removeEntry in interface Acl
Parameters:
entry - the ACL entry to be removed from this ACL
Returns:
true on success, false if the entry is not part of this ACL

entries

public Enumeration entries()
Returns an enumeration of the entries in this ACL. Each element in the enumeration is of type AclEntry.

Specified by:
entries in interface Acl
Returns:
an enumeration of the entries in this ACL.

getEntry

public AclEntry getEntry(Principal principal)
Returns an AclEntry for a supplied Principal, or null if the Principal does not have a matching AclEntry.

Specified by:
getEntry in interface Acl
Parameters:
principal - the principal to search for
Returns:
the AclEntry associated with the principal, or null

toString

public String toString()
Returns a string representation of the contents of this Acl.

Specified by:
toString in interface Acl
Overrides:
toString in class Object
Returns:
the string representation

isEmpty

public boolean isEmpty()
Returns true, if this Acl is empty.

Specified by:
isEmpty in interface Acl
Returns:
the result
Since:
2.4.68