AppserverIo\Appserver\ServletEngine\Security\SimpleGroup::addMember PHP Method

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
    public function addMember(PrincipalInterface $pricipal)
    {
        // query whether or not the passed prinicpal is already a member
        $isMember = $this->members->exists($pricipal->getName());
        // if the principal is not a member, add it
        if ($isMember === false) {
            $this->members->add($pricipal->getName(), $pricipal);
        }
        // return if the principal has successfully been added
        return $isMember === false;
    }