You are here

function ldap_user_reset_provision_server in Lightweight Directory Access Protocol (LDAP) 7.2

Resets the drupalAcctProvisionServer if needed.

Used when handling multi-domain authentication to set the provisioning server to be the server that last successfully authenticated the user.

Parameters

LdapUserConf $ldap_user_conf: The LDAP User Configuration object.

object $account: The Drupal user account.

3 calls to ldap_user_reset_provision_server()
ldap_servers_get_user_ldap_data in ldap_servers/ldap_servers.module
@todo needs caching element. several modules could potentially call this in the same page request.
ldap_user_user_login in ldap_user/ldap_user.module
Implements hook_user_login().
ldap_user_user_presave in ldap_user/ldap_user.module
Implements hook_user_presave()

File

ldap_user/ldap_user.module, line 1288
Module for the LDAP User Entity.

Code

function ldap_user_reset_provision_server($ldap_user_conf, $account) {

  // Reset the Provision Server sid to the server that last authenticated the user.
  if ($ldap_user_conf->drupalAcctProvisionServer == LDAP_USER_AUTH_SERVER_SID) {
    $sid = FALSE;
    if (isset($account->data['ldap_user']['init']['sid'])) {
      $sid = $account->data['ldap_user']['init']['sid'];
    }
    else {

      // Provisioning Server sid is not in the account object,
      // see if we have a session variable with it.
      $sid = isset($_SESSION[LDAP_USER_SESSION_PROV_SID]) ? $_SESSION[LDAP_USER_SESSION_PROV_SID] : FALSE;
    }
    if ($sid) {
      $ldap_user_conf->drupalAcctProvisionServer = $sid;
    }
  }
}