You are here

function ldap_servers_attributes_needed in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_servers/ldap_servers.functions.inc \ldap_servers_attributes_needed()

get array of required attributes for an ldap query

Parameters

string $sid server id or ldap server object being used:

string $direction LDAP_USER_PROV_DIRECTION_* constant:

string $ldap_context:

boolean $reset cache:

1 call to ldap_servers_attributes_needed()
LdapServer::userUserNameToExistingLdapEntry in ldap_servers/LdapServer.class.php
Queries LDAP server for the user.

File

ldap_servers/ldap_servers.functions.inc, line 108
collection of functions that don't belong in server object

Code

function ldap_servers_attributes_needed($sid, $ldap_context = 'all', $reset = TRUE) {
  static $attributes;
  $sid = is_object($sid) ? $sid->sid : $sid;
  $static_cache_id = $sid ? $ldap_context . '__' . $sid : $ldap_context;
  if (!is_array($attributes)) {
    $attributes = array();
  }
  if (!isset($attributes[$static_cache_id]) || $reset) {
    $params = array(
      'sid' => $sid,
      'ldap_context' => $ldap_context,
    );
    drupal_alter('ldap_attributes_needed', $attributes[$static_cache_id], $params);
  }
  $return = $attributes[$static_cache_id];
  return $return;
}