You are here

private function DrupalUserProcessor::applyAttributesToAccount in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_user/src/Processor/DrupalUserProcessor.php \Drupal\ldap_user\Processor\DrupalUserProcessor::applyAttributesToAccount()

Apply field values to user account.

One should not assume all attributes are present in the LDAP entry.

1 call to DrupalUserProcessor::applyAttributesToAccount()
DrupalUserProcessor::syncToDrupalAccount in ldap_user/src/Processor/DrupalUserProcessor.php
For a Drupal account, query LDAP, get all user fields and set them.

File

ldap_user/src/Processor/DrupalUserProcessor.php, line 596

Class

DrupalUserProcessor
Handles processing of a user from LDAP to Drupal.

Namespace

Drupal\ldap_user\Processor

Code

private function applyAttributesToAccount() : void {
  $this->fieldProvider
    ->loadAttributes(self::PROVISION_TO_DRUPAL, $this->server);
  $this
    ->setLdapBaseFields(self::EVENT_SYNC_TO_DRUPAL_USER);
  $this
    ->setUserDefinedMappings(self::EVENT_SYNC_TO_DRUPAL_USER);
  $context = [
    'ldap_server' => $this->server,
    'prov_event' => self::EVENT_SYNC_TO_DRUPAL_USER,
  ];
  $this->moduleHandler
    ->alter('ldap_user_edit_user', $this->account, $this->ldapEntry, $context);

  // Set ldap_user_last_checked.
  $this->account
    ->set('ldap_user_last_checked', time());
}