public static function ConversionHelper::setAttributeMap in Lightweight Directory Access Protocol (LDAP) 8.3
Set an attribute map.
Parameters
array $attribute: For a given attribute in the form ['values' => [], 'data_type' => NULL] as outlined in ldap_user/README.developers.txt.
string $conversion: As type of conversion to do @see ldap_servers_convert_attribute(), e.g. base64_encode, bin2hex, msguid, md5.
array $values: In form [<ordinal> => <value> | NULL], where NULL indicates value is needed for provisioning or other operations.
Return value
array Converted values. If nothing is passed in, create empty array in the proper structure ['values' => [0 => 'john', 1 => 'johnny']].
3 calls to ConversionHelper::setAttributeMap()
- ConversionHelper::extractTokenAttributes in ldap_servers/
src/ Helper/ ConversionHelper.php - Extract token attributes.
- DrupalUserProcessor::alterUserAttributes in ldap_user/
src/ Processor/ DrupalUserProcessor.php - Alter the user's attributes.
- ServerFactory::alterLdapAttributes in ldap_servers/
src/ ServerFactory.php - Alter the LDAP attributes.
File
- ldap_servers/
src/ Helper/ ConversionHelper.php, line 392
Class
- ConversionHelper
- Conversion helper to escape values correctly for LDAP filters.
Namespace
Drupal\ldap_servers\HelperCode
public static function setAttributeMap(array $attribute = NULL, $conversion = NULL, array $values = NULL) {
$attribute = is_array($attribute) ? $attribute : [];
$attribute['conversion'] = $conversion;
if (!$values && (!isset($attribute['values']) || !is_array($attribute['values']))) {
$attribute['values'] = [
0 => NULL,
];
}
elseif (is_array($values)) {
foreach ($values as $ordinal => $value) {
if ($conversion) {
$value = self::convertAttribute($value, $conversion);
}
$attribute['values'][(int) $ordinal] = $value;
}
}
return $attribute;
}