You are here

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

Apply field values to user account.

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

1 call to DrupalUserProcessor::applyAttributesToAccountOnCreate()
DrupalUserProcessor::createDrupalUser in ldap_user/src/Processor/DrupalUserProcessor.php
Create a Drupal user.

File

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

Class

DrupalUserProcessor
Handles processing of a user from LDAP to Drupal.

Namespace

Drupal\ldap_user\Processor

Code

private function applyAttributesToAccountOnCreate() : void {
  $this->fieldProvider
    ->loadAttributes(self::PROVISION_TO_DRUPAL, $this->server);
  $this
    ->setLdapBaseFields(self::EVENT_CREATE_DRUPAL_USER);
  $this
    ->setFieldsOnDrupalUserCreation();
  $this
    ->setUserDefinedMappings(self::EVENT_CREATE_DRUPAL_USER);
  $context = [
    'ldap_server' => $this->server,
    'prov_event' => self::EVENT_CREATE_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());
}