function ldapauth_user_lookup_by_dn in LDAP integration 6
Retrieves required attributes for specific user and operation.
Parameters
LDAPInterface $ldap An initialized LDAP server Interface object:
String $dn The LDAP user's dn:
String $op The type of load operation (see LDAPAUTH_SYNC_CONTEXT* constants):
boolean $reset If true the cache will be cleared.:
Return value
An array of the user's ldap attributes as defined by the operation.
9 calls to ldapauth_user_lookup_by_dn()
- hook_ldap_user_deny_alter in ./
ldapauth.api.php - Allow other modules (e.g. ldapgroups) to deny ldap user access to the server.
- 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.
- ldapgroups_user_test_output in ./
ldapgroups.admin.inc - Generate the test results for the user and ldap settings.
- ldaphelp_ldap_user_verify in ldaphelp/
ldaphelp.module - Verify that a user can be found from the Drupal account information.
File
- includes/
ldap.core.inc, line 600 - The core functions that ldapauth supplies for submodules. Will be included by default by ldapauth.
Code
function ldapauth_user_lookup_by_dn($ldap, $dn, $op, $reset = FALSE) {
static $ldap_user_cache = array();
if ($reset) {
$ldap_user_cache = array();
}
if (!$ldap) {
// Allow cache resets without lookup.
return FALSE;
}
$sid = $ldap
->getOption('sid');
if (!isset($ldap_user_cache[$op][$sid][$dn])) {
$attrs = ldapauth_attributes_needed($op, $ldap
->getOption('sid'));
$ldap_user_cache[$op][$sid][$dn] = $ldap
->retrieveAttributes($dn, $attrs);
}
return $ldap_user_cache[$op][$sid][$dn];
}