private function DrupalUserProcessor::applyUserAttributes in Lightweight Directory Access Protocol (LDAP) 8.3
Apply user attributes.
Parameters
array $availableUserAttributes: Available attributes.
array $mappings: Mappings.
string $direction: Synchronization direction.
Return value
array All attributes applied.
1 call to DrupalUserProcessor::applyUserAttributes()
- DrupalUserProcessor::alterLdapUserAttributes in ldap_user/
src/ Processor/ DrupalUserProcessor.php - LDAP attributes to alter.
File
- ldap_user/
src/ Processor/ DrupalUserProcessor.php, line 604
Class
- DrupalUserProcessor
- Handles processing of a user from LDAP to Drupal.
Namespace
Drupal\ldap_user\ProcessorCode
private function applyUserAttributes(array $availableUserAttributes, array $mappings, $direction) {
foreach ($mappings[$direction] as $target_token => $mapping) {
if ($direction == self::PROVISION_TO_DRUPAL && isset($mapping['user_attr'])) {
$key = $mapping['user_attr'];
}
elseif ($direction == self::PROVISION_TO_LDAP && isset($mapping['ldap_attr'])) {
$key = $mapping['ldap_attr'];
}
else {
continue;
}
$keys = [
'ldap_attr',
'user_attr',
'convert',
'direction',
'enabled',
'prov_events',
];
foreach ($keys as $subKey) {
if (isset($mapping[$subKey])) {
$availableUserAttributes[$key][$subKey] = $mapping[$subKey];
}
else {
$availableUserAttributes[$key][$subKey] = NULL;
}
$availableUserAttributes[$key]['config_module'] = 'ldap_user';
$availableUserAttributes[$key]['prov_module'] = 'ldap_user';
}
if ($mapping['user_attr'] == 'user_tokens') {
$availableUserAttributes['user_attr'] = $mapping['user_tokens'];
}
}
return $availableUserAttributes;
}