You are here

function ldap_servers_token_extract_parts in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_servers/ldap_servers.tokens.inc \ldap_servers_token_extract_parts()

Parameters

string $token: or token expression with singular token in it, eg. [dn], [dn;binary], [titles:0;binary] [cn]@mycompany.com.

Return value

array(<attr_name>, <ordinal>, <conversion>)

1 call to ldap_servers_token_extract_parts()
LdapUserConf::drupalUserToLdapEntry in ldap_user/LdapUserConf.class.php
Populate ldap entry array for provisioning.

File

ldap_servers/ldap_servers.tokens.inc, line 155
Collection of functions related to ldap tokens.

Code

function ldap_servers_token_extract_parts($token) {
  $attributes = [];
  ldap_servers_token_extract_attributes($attributes, $token);
  if (is_array($attributes)) {
    $keys = array_keys($attributes);
    $attr_name = $keys[0];
    $attr_data = $attributes[$attr_name];
    $ordinals = array_keys($attr_data['values']);
    $ordinal = $ordinals[0];
    return [
      $attr_name,
      $ordinal,
      $attr_data['conversion'],
    ];
  }
  else {
    return [
      NULL,
      NULL,
      NULL,
    ];
  }
}