public function isMember(PrincipalInterface $principal)
    {

        // first see if there is a key with the member name
        $isMember = $this->members->exists($principal->getName());

        if ($isMember === false) {
            // check the AnybodyPrincipal & NobodyPrincipal special cases
            $isMember = ($principal instanceof AnybodyPrincipal);
            if ($isMember === false) {
                if ($principal instanceof NobodyPrincipal) {
                    return false;
                }
            }
        }

        if ($isMember === false) {
            // check any groups for membership
            foreach ($this->members as $group) {
                if ($group instanceof GroupInterface) {
                    $isMember = $group->isMember($principal);
                }
            }
        }

        return $isMember;
    }
public function isMember(PrincipalInterface $principal)
    {

        // first see if there is a key with the member name
        $isMember = $this->members->exists($principal->getName());

        if ($isMember === false) {
            // check the AnybodyPrincipal & NobodyPrincipal special cases
            $isMember = ($principal instanceof AnybodyPrincipal);
            if ($isMember === false) {
                if ($principal instanceof NobodyPrincipal) {
                    return false;
                }
            }
        }

        if ($isMember === false) {
            // check any groups for membership
            foreach ($this->members as $group) {
                if ($group instanceof GroupInterface) {
                    $isMember = $group->isMember($principal);
                }
            }
        }

        return $isMember;
    }
public function isMember ( PrincipalInterface $ principal ) { // first see if there is a key with the member name $ isMember = $ this -> members -> exists ( $ principal -> getName ( ) ) ; if ( $ isMember === false ) { // check the AnybodyPrincipal & NobodyPrincipal special cases $ isMember = ( $ principal instanceof AnybodyPrincipal ) ; if ( $ isMember === false ) { if ( $ principal instanceof NobodyPrincipal ) { return false ; } } } if ( $ isMember === false ) { // check any groups for membership foreach ( $ this -> members as $ group ) { if ( $ group instanceof GroupInterface ) { $ isMember = $ group -> isMember ( $ principal ) ; } } } return $ isMember ; }
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
AnybodyPrincipal or NobodyPrincipal since these classes do not
hash to meaningful values.

@param \AppserverIo\Psr\Security\PrincipalInterface $principal The principal to query membership for

@return boolean TRUE if the principal is a member of this group, FALSE otherwise
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 .