You are here

public function LdapUserConf::getProvisionRelatedLdapEntry in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_user/LdapUserConf.class.php \LdapUserConf::getProvisionRelatedLdapEntry()

given a drupal account, find the related ldap entry.

Parameters

drupal user object $account:

Return value

FALSE or ldap entry

File

ldap_user/LdapUserConf.class.php, line 831

Class

LdapUserConf

Code

public function getProvisionRelatedLdapEntry($account, $prov_events = NULL) {
  if (!$prov_events) {
    $prov_events = ldap_user_all_events();
  }
  $sid = $this->ldapEntryProvisionServer;

  //

  //debug("ldapEntryProvisionServer:$sid");
  if (!$sid) {
    return FALSE;
  }

  // $user_entity->ldap_user_prov_entries,
  $ldap_server = ldap_servers_get_servers($sid, NULL, TRUE);
  $params = array(
    'direction' => LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
    'prov_events' => $prov_events,
    'module' => 'ldap_user',
    'function' => 'getProvisionRelatedLdapEntry',
    'include_count' => FALSE,
  );
  list($proposed_ldap_entry, $error) = $this
    ->drupalUserToLdapEntry($account, $ldap_server, $params);
  if (!(is_array($proposed_ldap_entry) && isset($proposed_ldap_entry['dn']) && $proposed_ldap_entry['dn'])) {
    return FALSE;
  }
  $ldap_entry = $ldap_server
    ->dnExists($proposed_ldap_entry['dn'], 'ldap_entry', array());
  return $ldap_entry;
}