com.ecyrd.jspwiki.auth.authorize
Interface Group

All Superinterfaces:
Principal
All Known Implementing Classes:
DefaultGroup

public interface Group
extends Principal

Groups are a specialized type of ad-hoc role used by the wiki system. Unlike externally-provided roles (such as those provided by an LDAP server or web container), JSPWiki groups can be created dynamically by wiki users, without requiring special container privileges or administrator intervention. They are designed to provide a lightweight role-based access control system that complements existing role systems.

Group names are case-insensitive, and have a few naming restrictions, which are enforced by the GroupManager:

Since:
2.3
Version:
$Revision: 1.7 $ $Date: 2006/06/17 23:11:24 $
Author:
Janne Jalkanen, Andrew Jaquith

Field Summary
static String[] RESTRICTED_GROUPNAMES
           
 
Method Summary
 boolean add(Principal principal)
          Adds a Principal to the group.
 void addWikiEventListener(WikiEventListener listener)
          Registers a WikiEventListener with this Group.
 void clear()
          Clears all Principals from the group list.
 boolean equals(Object o)
          Two DefaultGroups are considered equal if they both contains the same Principals and have the same name (case-insentive comparison).
 String getName()
          The name of the group.
 boolean isMember(Principal principal)
          Returns true if a Principal is a member of the group.
 Principal[] members()
          Returns the members of the group as an array of Principal objects.
 boolean remove(Principal principal)
          Removes a Principal from the group.
 void removeWikiEventListener(WikiEventListener listener)
          Un-registers a WikiEventListener from this Group.
 String toString()
          Provides a String representation.
 
Methods inherited from interface java.security.Principal
hashCode
 

Field Detail

RESTRICTED_GROUPNAMES

static final String[] RESTRICTED_GROUPNAMES
Method Detail

add

boolean add(Principal principal)
Adds a Principal to the group. When a Principal is added successfully, the Group implementation should send a WikiSecurityEvent of type WikiSecurityEvent.GROUP_ADD_MEMBER to all of its registered WikiEventListeners.

Parameters:
principal - the principal to add
Returns:
true if the operation was successful

addWikiEventListener

void addWikiEventListener(WikiEventListener listener)
Registers a WikiEventListener with this Group.

Parameters:
listener - the event listener

remove

boolean remove(Principal principal)
Removes a Principal from the group. When a Principal is added successfully, the Group implementation should send a WikiSecurityEvent of type WikiSecurityEvent.GROUP_REMOVE_MEMBER to all of its registered WikiEventListeners.

Parameters:
principal - the principal to remove
Returns:
true if the operation was successful

removeWikiEventListener

void removeWikiEventListener(WikiEventListener listener)
Un-registers a WikiEventListener from this Group.

Parameters:
listener - the event listener

clear

void clear()
Clears all Principals from the group list. When a Group's members are cleared successfully, the Group implementation should send a WikiSecurityEvent of type WikiSecurityEvent.GROUP_CLEAR_MEMBERS to all of its registered WikiEventListeners.


isMember

boolean isMember(Principal principal)
Returns true if a Principal is a member of the group. Specifically, the Principal's getName() method must return the same value as one of the Principals in the group member list. The Principal's type does not need to match.

Parameters:
principal - the principal about whom membeship status is sought
Returns:
the result of the operation

getName

String getName()
The name of the group. Typically, this is set in concrete classes' constructors.

Specified by:
getName in interface Principal
Returns:
the name of the Group

members

Principal[] members()
Returns the members of the group as an array of Principal objects.


equals

boolean equals(Object o)
Two DefaultGroups are considered equal if they both contains the same Principals and have the same name (case-insentive comparison).

Specified by:
equals in interface Principal
Overrides:
equals in class Object

toString

String toString()
Provides a String representation.

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