You are here

function cas_user_load in CAS 7

Implements hook_user_load().

Adds an associative array 'cas_names' to each user. The array keys are unique authentication mapping ids, with CAS usernames as the values.

2 calls to cas_user_load()
cas_user_insert in ./cas.module
Implements hook_user_insert().
cas_user_update in ./cas.module
Implements hook_user_update().

File

./cas.module, line 549
Enables users to authenticate via a Central Authentication Service (CAS) Cas will currently work if the auto registration is turned on and will create user accounts automatically.

Code

function cas_user_load($users) {
  foreach (array_keys($users) as $uid) {
    $users[$uid]->cas_names = array();
  }
  $result = db_query('SELECT aid, uid, cas_name FROM {cas_user} WHERE uid IN (:uids)', array(
    ':uids' => array_keys($users),
  ));
  foreach ($result as $record) {
    $users[$record->uid]->cas_names[$record->aid] = $record->cas_name;
  }
  foreach (array_keys($users) as $uid) {
    $users[$uid]->cas_name = reset($users[$uid]->cas_names);
  }
}