public function AccountProxy::getRoles in Restrict Login or Role Access by IP Address 8.4
Return roles for this user, less any that are restricted.
Parameters
bool $exclude_locked_roles: (optional) If TRUE, locked roles (anonymous/authenticated) are not returned.
Return value
array List of role IDs.
Overrides AccountInterface::getRoles
1 call to AccountProxy::getRoles()
- AccountProxy::hasPermission in src/
Session/ AccountProxy.php - Checks whether a user has a certain permission.
File
- src/
Session/ AccountProxy.php, line 47 - Contains \Drupal\restrict_by_ip\Session\AccountProxy.
Class
- AccountProxy
- When the current user is loaded, remove any roles that are restricted based on IP whitelists. Proxy all other method calls to the original current_user service.
Namespace
Drupal\restrict_by_ip\SessionCode
public function getRoles($exclude_locked_roles = FALSE) {
$roles = $this->original
->getRoles($exclude_locked_roles);
$remove_roles = $this->roleFirewall
->rolesToRemove();
return array_diff($roles, $remove_roles);
}