You are here

function ldapauth_ldap_attributes_needed_alter in LDAP integration 6

Implements hook_ldap_attributes_needed_alter

Parameters

Array $attributes array of attributes to be returned from ldap queries:

String $op The operation being performed:

Mixed $server Server sid or server object:

File

./ldapauth.module, line 776
ldapauth provides authentication against ldap server.

Code

function ldapauth_ldap_attributes_needed_alter(&$attributes, $op, $server = NULL) {
  $attributes[] = 'dn';

  // DN is minimum attribute for all ops.
  if ($server) {
    $ldap_server = is_object($server) ? $server : ldapauth_server_load($server);
    switch ($op) {
      case LDAPAUTH_SYNC_CONTEXT_INSERT_DRUPAL_USER:
      case LDAPAUTH_SYNC_CONTEXT_UPDATE_DRUPAL_USER:
      case LDAPAUTH_SYNC_CONTEXT_AUTHENTICATE_DRUPAL_USER:
        $attributes[] = $ldap_server->user_attr;
        $attributes[] = $ldap_server->mail_attr;
        if (!empty($ldap_server->puid_attr)) {
          $attributes[] = $ldap_server->puid_attr;
        }
        break;
    }
  }
}