You are here

function ldapauth_drupal_user_name in LDAP integration 6

Allow modules to do site dependent login form name to drupal account name mapping.

Calls the hook_ldap_drupal_user_name_alter function(s) once per name.

Parameters

String $name Name entered on login form (case insensitive match to user attr).:

LDAPInterface $ldap Fully initialized LDAP server interface object:

boolean $reset If true the cache will be cleared.:

String $dn The DN that has been authenticated with LDAP.:

4 calls to ldapauth_drupal_user_name()
ldapauth_authenticate in ./ldapauth.module
Main user authentication function. Called by form validator.
ldapauth_drupal_user_create in includes/ldap.core.inc
Create a new Drupal user from an LDAP user entry with checks to ensure that:
ldapauth_drupal_user_lookup in includes/ldap.core.inc
Map an LDAP user to a Drupal user account if one exists.
_ldapsync_process_entry in ./ldapsync.module
Take an ldap object entry and determine if there is an existing account or a new account needs to be created.

File

includes/ldap.core.inc, line 628
The core functions that ldapauth supplies for submodules. Will be included by default by ldapauth.

Code

function ldapauth_drupal_user_name($name, $ldap, $dn, $reset = FALSE) {
  static $drupal_names = array();
  if ($reset) {
    $drupal_name = array();
  }
  if (!$name) {

    // Allow reset with no lookup.
    return FALSE;
  }
  if (!isset($drupal_names[$name])) {
    $new_name = $name;
    drupal_alter('ldap_drupal_user_name', $new_name, $ldap, $dn);
    $drupal_names[$name] = $new_name;
  }
  return $drupal_names[$name];
}