PHP Class AppserverIo\Appserver\ServletEngine\Security\SimpleGroup

Inheritance: extends SimplePrincipal, implements AppserverIo\Psr\Security\Acl\GroupInterface
显示文件 Open project: appserver-io/appserver

Public Methods

Method Description
__construct ( string $name ) Initialize the principal with the passed name.
__toString ( ) : string Returns the principals name as string.
addMember ( AppserverIo\Psr\Security\PrincipalInterface $pricipal ) : boolean Adds the passed principal to the group.
getMembers ( ) : AppserverIo\Collections\HashMap Return's the group's members.
isMember ( AppserverIo\Psr\Security\PrincipalInterface $principal ) : boolean Returns TRUE if the passed principal is a member of the group.
removeMember ( AppserverIo\Psr\Security\PrincipalInterface $principal ) : boolean Removes the passed principal from the group.

Method Details

__construct() public method

Initialize the principal with the passed name.
public __construct ( string $name )
$name string The principal's name

__toString() public method

Returns the principals name as string.
public __toString ( ) : string
return string The principal's name

addMember() public method

Adds the passed principal to the group.
public addMember ( AppserverIo\Psr\Security\PrincipalInterface $pricipal ) : boolean
$pricipal AppserverIo\Psr\Security\PrincipalInterface The principal to add
return boolean TRUE if the member was successfully added, FALSE if the principal was already a member

getMembers() public method

Return's the group's members.
public getMembers ( ) : AppserverIo\Collections\HashMap
return AppserverIo\Collections\HashMap The group members

isMember() public method

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 AnybodyPrincipal or NobodyPrincipal since these classes do not hash to meaningful values.
public isMember ( AppserverIo\Psr\Security\PrincipalInterface $principal ) : boolean
$principal AppserverIo\Psr\Security\PrincipalInterface The principal to query membership for
return boolean TRUE if the principal is a member of this group, FALSE otherwise

removeMember() public method

Removes the passed principal from the group.
public removeMember ( AppserverIo\Psr\Security\PrincipalInterface $principal ) : boolean
$principal AppserverIo\Psr\Security\PrincipalInterface The principal to remove
return boolean TRUE if the member was successfully removed, FALSE if the principal was not a member