function shib_auth_generate_rolenames in Shibboleth Authentication 7.4
Same name and namespace in other branches
- 6.4 shib_auth.module \shib_auth_generate_rolenames()
Generates role name cache.
Retrieves all roles from database and stores the id->name mapping in the users' session.
Parameters
bool $force: If it is TRUE, the cache is regenerated.
3 calls to shib_auth_generate_rolenames()
- shib_auth_form_alter in ./
shib_auth.module - Alters user_login form for the shibboleth authentication module.
- shib_auth_role_assignment in ./
shib_auth.module - Assigns roles to the user's session.
- _shib_auth_list_rules in ./
shib_auth_roles_forms.inc - Lists all rules, and let the admin to do certain actions with them.
File
- ./
shib_auth.module, line 1464 - Drupal Shibboleth authentication module.
Code
function shib_auth_generate_rolenames($force) {
if (!isset($_SESSION['shib_auth_rolecache']) || $force) {
$_SESSION['shib_auth_rolecache'] = array();
$roles = db_select('role')
->fields('role', array(
'rid',
'name',
))
->execute();
$rolecache = array();
while ($item = $roles
->fetchAssoc()) {
$rolecache[$item['rid']] = $item['name'];
}
$_SESSION['shib_auth_rolecache'] = $rolecache;
}
}