public function getPermissionsForPrincipal($principalId)
    {
        if (empty($principalId)) {
            throw new IllegalStateException('Principal ID must be set!');
        }

        $currentAcl = $this->getAcl();

        if ($currentAcl === null) {
            throw new IllegalStateException('ACLs are not available');
        }

        $result = [];

        foreach ($currentAcl->getAces() as $ace) {
            if ($principalId === $ace->getPrincipalId() && count($ace->getPermissions()) > 0) {
                $result = array_merge($result, $ace->getPermissions());
            }
        }

        return $result;
    }
public function getPermissionsForPrincipal($principalId)
    {
        if (empty($principalId)) {
            throw new IllegalStateException('Principal ID must be set!');
        }

        $currentAcl = $this->getAcl();

        if ($currentAcl === null) {
            throw new IllegalStateException('ACLs are not available');
        }

        $result = [];

        foreach ($currentAcl->getAces() as $ace) {
            if ($principalId === $ace->getPrincipalId() && count($ace->getPermissions()) > 0) {
                $result = array_merge($result, $ace->getPermissions());
            }
        }

        return $result;
    }
public function getPermissionsForPrincipal ( $ principalId ) { if ( empty ( $ principalId ) ) { throw new IllegalStateException ( 'Principal ID must be set!' ) ; } $ currentAcl = $ this -> getAcl ( ) ; if ( $ currentAcl === null ) { throw new IllegalStateException ( 'ACLs are not available' ) ; } $ result = [ ] ; foreach ( $ currentAcl -> getAces ( ) as $ ace ) { if ( $ principalId === $ ace -> getPrincipalId ( ) && count ( $ ace -> getPermissions ( ) ) > 0 ) { $ result = array_merge ( $ result , $ ace -> getPermissions ( ) ) ; } } return $ result ; }
Returns all permissions for the given principal from the ACL.

@param string $principalId the principal ID
@return string[] the set of permissions for this user, or an empty set if principal is not in the ACL
@throws IllegalStateException if the ACL hasn't been fetched or provided by the repository
Returns all permissions for the given principal from the ACL .