Neos.Neos/Classes/Domain/Service/UserService.php
protected function getAllRoles(User $user)
    {
        $roles = [
            'Neos.Flow:Everybody' => $this->policyService->getRole('Neos.Flow:Everybody'),
            'Neos.Flow:AuthenticatedUser' => $this->policyService->getRole('Neos.Flow:AuthenticatedUser')
        ];

        /** @var Account $account */
        foreach ($user->getAccounts() as $account) {
            $accountRoles = $account->getRoles();
            /** @var $currentRole Role */
            foreach ($accountRoles as $currentRole) {
                if (!in_array($currentRole, $roles)) {
                    $roles[$currentRole->getIdentifier()] = $currentRole;
                }
                /** @var $currentParentRole Role */
                foreach ($currentRole->getAllParentRoles() as $currentParentRole) {
                    if (!in_array($currentParentRole, $roles)) {
                        $roles[$currentParentRole->getIdentifier()] = $currentParentRole;
                    }
                }
            }
        }

        return $roles;
    }
protected function getAllRoles(User $user)
    {
        $roles = [
            'Neos.Flow:Everybody' => $this->policyService->getRole('Neos.Flow:Everybody'),
            'Neos.Flow:AuthenticatedUser' => $this->policyService->getRole('Neos.Flow:AuthenticatedUser')
        ];

        /** @var Account $account */
        foreach ($user->getAccounts() as $account) {
            $accountRoles = $account->getRoles();
            /** @var $currentRole Role */
            foreach ($accountRoles as $currentRole) {
                if (!in_array($currentRole, $roles)) {
                    $roles[$currentRole->getIdentifier()] = $currentRole;
                }
                /** @var $currentParentRole Role */
                foreach ($currentRole->getAllParentRoles() as $currentParentRole) {
                    if (!in_array($currentParentRole, $roles)) {
                        $roles[$currentParentRole->getIdentifier()] = $currentParentRole;
                    }
                }
            }
        }

        return $roles;
    }
protected function getAllRoles ( User $ user ) { $ roles = [ 'Neos.Flow:Everybody' => $ this -> policyService -> getRole ( 'Neos.Flow:Everybody' ) , 'Neos.Flow:AuthenticatedUser' => $ this -> policyService -> getRole ( 'Neos.Flow:AuthenticatedUser' ) ] ; /** @var Account $account */ foreach ( $ user -> getAccounts ( ) as $ account ) { $ accountRoles = $ account -> getRoles ( ) ; /** @var $currentRole Role */ foreach ( $ accountRoles as $ currentRole ) { if ( ! in_array ( $ currentRole , $ roles ) ) { $ roles [ $ currentRole -> getIdentifier ( ) ] = $ currentRole ; } /** @var $currentParentRole Role */ foreach ( $ currentRole -> getAllParentRoles ( ) as $ currentParentRole ) { if ( ! in_array ( $ currentParentRole , $ roles ) ) { $ roles [ $ currentParentRole -> getIdentifier ( ) ] = $ currentParentRole ; } } } } return $ roles ; }
Returns an array with all roles of a user's accounts, including parent roles, the "Everybody" role and the
"AuthenticatedUser" role, assuming that the user is logged in.

@param User $user The user
@return array
Returns an array with all roles of a user s accounts including parent roles the Everybody role and the AuthenticatedUser role assuming that the user is logged in .