You are here

public function LdapEntryProvisionSubscriber::userUpdated in Lightweight Directory Access Protocol (LDAP) 8.4

Create or update LDAP entries on user update.

Parameters

\Drupal\ldap_user\Event\LdapUserUpdatedEvent $event: Event.

File

ldap_user/src/EventSubscriber/LdapEntryProvisionSubscriber.php, line 198

Class

LdapEntryProvisionSubscriber
Event subscribers for creating and updating LDAP entries.

Namespace

Drupal\ldap_user\EventSubscriber

Code

public function userUpdated(LdapUserUpdatedEvent $event) : void {
  $this->account = $event->account;
  if ($this
    ->provisionLdapEntriesFromDrupalUsers() && \in_array(self::PROVISION_LDAP_ENTRY_ON_USER_ON_USER_UPDATE_CREATE, $this->config
    ->get('ldapEntryProvisionTriggers'), TRUE) && $this->account
    ->get('ldap_user_ldap_exclude')
    ->getString() !== '1') {
    $this
      ->loadServer();
    if ($this
      ->checkExistingLdapEntry()) {
      $this
        ->syncToLdapEntry();
    }
    else {

      // This should only be necessary if the entry was deleted on the
      // directory server.
      $this
        ->provisionLdapEntry();
    }
  }
}