Neos\Flow\Security\Policy\Role::getAllParentRoles PHP Method

getAllParentRoles() public method

Returns all (directly and indirectly reachable) parent roles for the given role.
public getAllParentRoles ( ) : Role[]
return Role[] Array of parent roles, indexed by role identifier
    public function getAllParentRoles()
    {
        $result = [];
        foreach ($this->parentRoles as $parentRoleIdentifier => $currentParentRole) {
            if (isset($result[$parentRoleIdentifier])) {
                continue;
            }
            $result[$parentRoleIdentifier] = $currentParentRole;
            $currentGrandParentRoles = $currentParentRole->getAllParentRoles();
            foreach ($currentGrandParentRoles as $currentGrandParentRoleIdentifier => $currentGrandParentRole) {
                if (!isset($result[$currentGrandParentRoleIdentifier])) {
                    $result[$currentGrandParentRoleIdentifier] = $currentGrandParentRole;
                }
            }
        }
        return $result;
    }