You are here

public function LdapServer::drupalUserFromPuid in Lightweight Directory Access Protocol (LDAP) 7

Parameters

scalar $puid is permanent unique id value and:

File

ldap_servers/LdapServer.class.php, line 58
Defines server classes and related functions.

Class

LdapServer
LDAP Server Class

Code

public function drupalUserFromPuid($puid) {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'user')
    ->fieldCondition('ldap_user_puid_sid', 'value', $this->sid, '=')
    ->fieldCondition('ldap_user_puid', 'value', $puid, '=')
    ->fieldCondition('ldap_user_puid_property', 'value', $this->unique_persistent_attr, '=')
    ->addMetaData('account', user_load(1));

  // run the query as user 1
  $result = $query
    ->execute();
  if (isset($result['user'])) {
    $user = entity_load('user', array_keys($result['user']));
  }
}