protected function getAllRoles(User $user)
{
$roles = array('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;
}