You are here

function ldapauth_user in LDAP integration 5

Same name and namespace in other branches
  1. 5.2 ldapauth.module \ldapauth_user()
  2. 6 ldapauth.module \ldapauth_user()

File

./ldapauth.module, line 655

Code

function ldapauth_user($op, &$edit, &$edit_user, $category = NULL) {
  global $user;
  switch ($op) {
    case 'login':

      // This is to convert from old ldap_integration to new ldapauth
      if ($user->ldap_authentified) {
        db_query("UPDATE {authmap} SET module = 'ldapauth' WHERE uid = '%d'", $user->uid);
        return;
      }
      break;
    case 'form':
      if (user_access('administer users')) {
        $form['ldap_settings'] = array(
          '#type' => 'fieldset',
          '#title' => 'LDAP authentication settings',
          '#collapsible' => TRUE,
        );
        $form['ldap_settings']['ldap_authentified'] = array(
          '#type' => 'checkbox',
          '#title' => 'Authenticate via LDAP',
          '#default_value' => $edit_user->ldap_authentified,
        );
        $form['ldap_settings']['ldap_dn'] = array(
          '#type' => 'textfield',
          '#title' => 'LDAP User DN',
          '#default_value' => $edit_user->ldap_dn,
        );
        return $form;
      }
      break;
  }
}