You are here

protected function MasqueradePermissions::getUserRoles in Masquerade 8.2

Returns role entities allowed to masquerade as.

Return value

\Drupal\user\RoleInterface[] An associative array with the role id as the key and the role object as value.

1 call to MasqueradePermissions::getUserRoles()
MasqueradePermissions::permissions in src/MasqueradePermissions.php
Returns an array of masquerade permissions.

File

src/MasqueradePermissions.php, line 47

Class

MasqueradePermissions
Provides dynamic permissions of the masquerade module.

Namespace

Drupal\masquerade

Code

protected function getUserRoles() {
  $roles = Role::loadMultiple();

  // Do not allow masquerade as anonymous user, use private browsing.
  unset($roles[RoleInterface::ANONYMOUS_ID]);
  return $roles;
}