You are here

public function LdapUserConf::getLdapUserRequiredAttributes in Lightweight Directory Access Protocol (LDAP) 7.2

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

Util to fetch attributes required for this user conf, not other modules.

Parameters

enum $direction: LDAP_USER_PROV_DIRECTION_* constants.

string $ldap_context:

File

ldap_user/LdapUserConf.class.php, line 359

Class

LdapUserConf

Code

public function getLdapUserRequiredAttributes($direction = LDAP_USER_PROV_DIRECTION_ALL, $ldap_context = NULL) {
  $attributes_map = [];
  $required_attributes = [];
  if ($this->drupalAcctProvisionServer) {
    $prov_events = $this
      ->ldapContextToProvEvents($ldap_context);
    $attributes_map = $this
      ->getSynchMappings($direction, $prov_events);
    $required_attributes = [];
    foreach ($attributes_map as $detail) {
      if (count(array_intersect($prov_events, $detail['prov_events']))) {

        // Add the attribute to our array.
        if ($detail['ldap_attr']) {
          ldap_servers_token_extract_attributes($required_attributes, $detail['ldap_attr']);
        }
      }
    }
  }
  return $required_attributes;
}