Class SimpleGroup

  • All Implemented Interfaces:
    Serializable, Cloneable, Group, Principal

    public class SimpleGroup
    extends SimplePrincipal
    implements Group, Cloneable
    Forked class because this plugin can be used on both JBoss or Tomcat and we want to be independent on AS. An implementation of Group that manages a collection of Principal objects based on their hashCode() and equals() methods. This class is not thread safe.
    Version:
    $Revision$
    Author:
    Scott.Stark@jboss.org
    See Also:
    Serialized Form
    • Constructor Detail

      • SimpleGroup

        public SimpleGroup​(String groupName)
    • Method Detail

      • addMember

        public boolean addMember​(Principal user)
        Adds the specified member to the group.
        Specified by:
        addMember in interface Group
        Parameters:
        user - the principal to add to this group.
        Returns:
        true if the member was successfully added, false if the principal was already a member.
      • isMember

        public boolean isMember​(Principal member)
        Returns true if the passed principal is a member of the group. This method does a recursive search, so if a principal belongs to a group which is a member of this group, true is returned. A special check is made to see if the member is an instance of org.jboss.security.AnybodyPrincipal or org.jboss.security.NobodyPrincipal since these classes do not hash to meaningful values.
        Specified by:
        isMember in interface Group
        Parameters:
        member - the principal whose membership is to be checked.
        Returns:
        true if the principal is a member of this group, false otherwise.
      • members

        public Enumeration<Principal> members()
        Returns an enumeration of the members in the group. The returned objects can be instances of either Principal or Group (which is a subinterface of Principal).
        Specified by:
        members in interface Group
        Returns:
        an enumeration of the group members.
      • removeMember

        public boolean removeMember​(Principal user)
        Removes the specified member from the group.
        Specified by:
        removeMember in interface Group
        Parameters:
        user - the principal to remove from this group.
        Returns:
        true if the principal was removed, or false if the principal was not a member.