You are here

function ldapauth_userinfo_save in LDAP integration 6

Create / Update a record in the ldapauth_users table.

Parameters

Mixed $userinfo Object or Array containing record info.:

4 calls to ldapauth_userinfo_save()
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 149
The core functions that ldapauth supplies for submodules. Will be included by default by ldapauth.

Code

function ldapauth_userinfo_save($userinfo) {
  if (is_array($userinfo)) {
    $userinfo = (object) $userinfo;
    $array = TRUE;
  }
  else {
    $array = FALSE;
  }
  if (isset($userinfo->luid)) {
    $update = 'luid';
  }
  if (!($rc = drupal_write_record('ldapauth_users', $userinfo, $update))) {
    drupal_set_message(t('Failed to write the ldap user info for uid: %name .', array(
      '%name' => $userinfo->uid,
    )), 'warning');
  }
  if ($array) {
    $userinfo = (array) $userinfo;
  }
  return $rc;
}