- Issue created by @mi-dave
We have "Schedule user updates" enabled and pointing to a working LDAP query.
I unticked "Create or Sync to Drupal user on successful authentication with LDAP credentials" because we don't want users to be created or updated at login time, only during the scheduled sync.
I later discovered the scheduled syncs had stopped working correctly - while new users were created, existing users were never updated.
<!--break-->I believe the reasoning is as follows:
ldap_user_cron()
calls GroupUserUpdateProcessor::runQuery()
.GroupUserUpdateProcessor::processAccount()
.DrupalUserProcessor::drupalUserLogsIn()
.DrupalUserProcessor::syncToDrupalAccount()
.As a result, when it is unticked, syncToDrupalAccount()
is never called.
I don't think $this->drupalUserProcessor->drupalUserLogsIn($drupal_account)
should be used in the cron job, as they are not logging in at this point. I would add another function to call instead, for example:
/** * Handle Drupal user scheduled update. * * @param \Drupal\user\UserInterface $account * The Drupal user. */ public function drupalUserScheduledUpdate(UserInterface $account): void { if ($this->excludeUser($this->account)) { return; } $this->account = $account; $this->syncToDrupalAccount(); $this->saveAccount(); }
Active
4.12
Code