private function DrupalUserProcessor::syncToDrupalAccount 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::syncToDrupalAccount()
For a Drupal account, query LDAP, get all user fields and save.
Parameters
int $provisioningEvent: The provisioning event.
array $ldapUser: A user's LDAP entry. Passed to avoid re-querying LDAP in cases where already present.
Return value
bool Attempts to sync, reports failure if unsuccessful.
4 calls to DrupalUserProcessor::syncToDrupalAccount()
- DrupalUserProcessor::drupalUserUpdated in ldap_user/
src/ Processor/ DrupalUserProcessor.php - Callback for hook_ENTITY_TYPE_update().
- DrupalUserProcessor::ldapAssociateDrupalAccount in ldap_user/
src/ Processor/ DrupalUserProcessor.php - Set LDAP associations of a Drupal account by altering user fields.
- DrupalUserProcessor::newDrupalUserCreated in ldap_user/
src/ Processor/ DrupalUserProcessor.php - Callback for hook_ENTITY_TYPE_insert().
- DrupalUserProcessor::updateExistingAccountByPersistentUid in ldap_user/
src/ Processor/ DrupalUserProcessor.php - Update Drupal user from PUID.
File
- ldap_user/
src/ Processor/ DrupalUserProcessor.php, line 992
Class
- DrupalUserProcessor
- Handles processing of a user from LDAP to Drupal.
Namespace
Drupal\ldap_user\ProcessorCode
private function syncToDrupalAccount($provisioningEvent = NULL, array $ldapUser = NULL) {
if ($provisioningEvent == NULL) {
$provisioningEvent = self::EVENT_SYNC_TO_DRUPAL_USER;
}
if (!$ldapUser && !method_exists($this->account, 'getAccountName') || !$this->account) {
\Drupal::logger('ldap_user')
->notice('Invalid selection passed to syncToDrupalAccount.');
return FALSE;
}
if (!$ldapUser && $this->config
->get('drupalAcctProvisionServer')) {
$ldapUser = $this->factory
->getUserDataFromServerByAccount($this->account, $this->config
->get('drupalAcctProvisionServer'), 'ldap_user_prov_to_drupal');
}
if (!$ldapUser) {
return FALSE;
}
if ($this->config
->get('drupalAcctProvisionServer')) {
$this->server = Server::load($this->config
->get('drupalAcctProvisionServer'));
$this
->applyAttributesToAccount($ldapUser, self::PROVISION_TO_DRUPAL, [
$provisioningEvent,
]);
}
$this
->saveAccount();
return TRUE;
}