You are here

public function DrupalUserProcessor::drupalUserLogsIn 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::drupalUserLogsIn()

Handle Drupal user login.

Parameters

\Drupal\user\UserInterface $account: The Drupal user.

File

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

Class

DrupalUserProcessor
Handles processing of a user from LDAP to Drupal.

Namespace

Drupal\ldap_user\Processor

Code

public function drupalUserLogsIn(UserInterface $account) : void {
  $this->account = $account;
  if ($this
    ->excludeUser($this->account)) {
    return;
  }
  $triggers = $this->config
    ->get('drupalAcctProvisionTriggers');
  $server = $this->config
    ->get('drupalAcctProvisionServer');
  if ($server && in_array(self::PROVISION_DRUPAL_USER_ON_USER_AUTHENTICATION, $triggers, TRUE)) {
    $this
      ->syncToDrupalAccount();
  }
  $event = new LdapUserLoginEvent($account);
  if (version_compare(\Drupal::VERSION, '9.1', '>=')) {
    $this->eventDispatcher
      ->dispatch($event, LdapUserLoginEvent::EVENT_NAME);
  }
  else {
    $this->eventDispatcher
      ->dispatch(LdapUserLoginEvent::EVENT_NAME, $event);
  }
}