You are here

function ldapauth_attributes_needed in LDAP integration 6

get array of required attributes for an ldap query.

The op parameter should be one of the LDAPAUTH_SYNC_CONTEXT* constants.

Parameters

string $op is operation being performed:

string $sid server id being used:

3 calls to ldapauth_attributes_needed()
ldapauth_user_lookup_by_dn in includes/ldap.core.inc
Retrieves required attributes for specific user and operation.
_ldapauth_user_lookup in ./ldapauth.module
Queries LDAP server for the user.
_ldapsync_search in ./ldapsync.module
Find all LDAP users from servers and OUs specified in ldapauth settings and create or update existing users as needed.

File

includes/ldap.core.inc, line 239
The core functions that ldapauth supplies for submodules. Will be included by default by ldapauth.

Code

function ldapauth_attributes_needed($op, $sid = NULL, $reset = FALSE) {
  static $attributes = array();
  if ($reset) {
    $attributes = array();
  }
  if (!isset($attributes[$sid][$op])) {
    drupal_alter('ldap_attributes_needed', $attributes[$sid][$op], $op, $sid);

    // attributes array needs to have no gaps of ldap_search(), ldap_read(), ldap_list() so apply array_values()
    $attributes[$sid][$op] = array_values(array_unique($attributes[$sid][$op]));
  }
  return $attributes[$sid][$op];
}