You are here

function cas_update_6302 in CAS 6.3

Same name and namespace in other branches
  1. 7 cas.install \cas_update_6302()

Remove 'hijack user' and 'Drupal is CAS user repository' options.

File

./cas.install, line 257
Installation hooks for the CAS module.

Code

function cas_update_6302() {
  $messages = array();
  $t = get_t();
  if (variable_get('cas_authmap', 0) || variable_get('cas_hijack_user', 0)) {

    // Create a mapping in {cas_user} for each current Drupal user.
    // The code below generates SQL equivalent to:
    //   INSERT INTO cas_user (uid, cas_name)
    //   SELECT u.uid AS uid, u.name as cas_name
    //   FROM users u
    //   WHERE uid <> 0 AND NOT EXISTS (SELECT cas_name FROM cas_user c WHERE c.cas_name = u.name);
    db_query("INSERT INTO {cas_user} (uid, cas_name) SELECT u.uid AS uid, u.name AS cas_name FROM {users} u WHERE uid <> 0 AND NOT EXISTS (SELECT cas_name FROM {cas_user} c WHERE c.cas_name = u.name)");
    $messages[] = array(
      'success' => TRUE,
      'query' => $t('Users have been automatically assigned their CAS username. For more information, see "Associating CAS usernames with Drupal users" in the CAS module README.txt.'),
    );
  }
  variable_del('cas_authmap');
  variable_del('cas_hijack_user');
  return $messages;
}