private function DrupalUserProcessor::setLdapBaseFields in Lightweight Directory Access Protocol (LDAP) 8.3
Same name and namespace in other branches
- 8.4 ldap_user/src/Processor/DrupalUserProcessor.php \Drupal\ldap_user\Processor\DrupalUserProcessor::setLdapBaseFields()
Sets the fields required by LDAP.
Parameters
array $ldapUser: Ldap user data.
string $direction: Provision direction.
array $prov_events: Provisioning event.
1 call to DrupalUserProcessor::setLdapBaseFields()
- DrupalUserProcessor::applyAttributesToAccount in ldap_user/
src/ Processor/ DrupalUserProcessor.php - Apply field values to user account.
File
- ldap_user/
src/ Processor/ DrupalUserProcessor.php, line 1095
Class
- DrupalUserProcessor
- Handles processing of a user from LDAP to Drupal.
Namespace
Drupal\ldap_user\ProcessorCode
private function setLdapBaseFields(array $ldapUser, $direction, array $prov_events) {
// Basic $user LDAP fields.
$mappingHelper = new SyncMappingHelper();
if ($mappingHelper
->isSynced('[property.name]', $prov_events, $direction)) {
$this->account
->set('name', $this->server
->userUsernameFromLdapEntry($ldapUser['attr']));
}
if ($mappingHelper
->isSynced('[property.mail]', $prov_events, $direction)) {
$derived_mail = $this->server
->userEmailFromLdapEntry($ldapUser['attr']);
if ($derived_mail) {
$this->account
->set('mail', $derived_mail);
}
}
if ($mappingHelper
->isSynced('[property.picture]', $prov_events, $direction)) {
$picture = $this
->userPictureFromLdapEntry($ldapUser['attr']);
if ($picture) {
$this->account
->set('user_picture', $picture);
}
}
if ($mappingHelper
->isSynced('[field.ldap_user_puid]', $prov_events, $direction)) {
$ldap_user_puid = $this->server
->userPuidFromLdapEntry($ldapUser['attr']);
if ($ldap_user_puid) {
$this->account
->set('ldap_user_puid', $ldap_user_puid);
}
}
if ($mappingHelper
->isSynced('[field.ldap_user_puid_property]', $prov_events, $direction)) {
$this->account
->set('ldap_user_puid_property', $this->server
->get('unique_persistent_attr'));
}
if ($mappingHelper
->isSynced('[field.ldap_user_puid_sid]', $prov_events, $direction)) {
$this->account
->set('ldap_user_puid_sid', $this->server
->id());
}
if ($mappingHelper
->isSynced('[field.ldap_user_current_dn]', $prov_events, $direction)) {
$this->account
->set('ldap_user_current_dn', $ldapUser['dn']);
}
}