private function SyncMappingHelper::processSyncMappings in Lightweight Directory Access Protocol (LDAP) 8.3
Derive synchronization mappings from configuration.
This function would be private if not for easier access for tests.
return array
1 call to SyncMappingHelper::processSyncMappings()
- SyncMappingHelper::loadSyncMappings in ldap_user/
src/ Helper/ SyncMappingHelper.php - Fetches the sync mappings from cache or loads them from configuration.
File
- ldap_user/
src/ Helper/ SyncMappingHelper.php, line 175
Class
- SyncMappingHelper
- Helper class to process user field synchronisation mappings.
Namespace
Drupal\ldap_user\HelperCode
private function processSyncMappings() {
$available_user_attributes = [];
foreach ([
self::PROVISION_TO_DRUPAL,
self::PROVISION_TO_LDAP,
] as $direction) {
if ($direction == self::PROVISION_TO_DRUPAL) {
$sid = $this->config
->get('drupalAcctProvisionServer');
}
else {
$sid = $this->config
->get('ldapEntryProvisionServer');
}
$available_user_attributes[$direction] = [];
$ldap_server = FALSE;
if ($sid) {
try {
$ldap_server = Server::load($sid);
} catch (\Exception $e) {
\Drupal::logger('ldap_user')
->error('Missing server');
}
}
$params = [
'ldap_server' => $ldap_server,
'direction' => $direction,
];
// This function does not add any attributes by itself but allows modules
// such as ldap_user to inject them through this hook.
\Drupal::moduleHandler()
->alter('ldap_user_attrs_list', $available_user_attributes[$direction], $params);
}
$this
->setAllSyncMappings($available_user_attributes);
}