public function AutologoutManager::getRoleTimeout in Automated Logout 8
Go through every role to get timeout value, default is the global timeout.
Return value
int Number of seconds timeout set for the user role.
Overrides AutologoutManagerInterface::getRoleTimeout
1 call to AutologoutManager::getRoleTimeout()
- AutologoutManager::getUserTimeout in src/
AutologoutManager.php - Get a user's timeout in seconds.
File
- src/
AutologoutManager.php, line 210
Class
- AutologoutManager
- Defines an AutologoutManager service.
Namespace
Drupal\autologoutCode
public function getRoleTimeout() {
$roles = user_roles(TRUE);
$role_timeout = [];
// Go through roles, get timeouts for each and return as array.
foreach ($roles as $name => $role) {
$role_settings = $this->configFactory
->get('autologout.role.' . $name);
if ($role_settings
->get('enabled')) {
$timeout_role = $role_settings
->get('timeout');
$role_timeout[$name] = $timeout_role;
}
}
return $role_timeout;
}