function UserSession::getRoles
Overrides AccountInterface::getRoles
1 call to UserSession::getRoles()
- UserSession::hasRole in core/
lib/ Drupal/ Core/ Session/ UserSession.php - Whether a user has a certain role.
File
-
core/
lib/ Drupal/ Core/ Session/ UserSession.php, line 95
Class
- UserSession
- An implementation of the user account interface for the global user.
Namespace
Drupal\Core\SessionCode
public function getRoles($exclude_locked_roles = FALSE) {
$roles = $this->roles;
if ($exclude_locked_roles) {
$roles = array_values(array_diff($roles, [
AccountInterface::ANONYMOUS_ROLE,
AccountInterface::AUTHENTICATED_ROLE,
]));
}
return $roles;
}