Problem/Motivation
simple_ldap_user_user_load checks with LDAP every time a user entity is loaded. This is done to ensure consistency with the LDAP state. In fact it is our main down sync method. That means that user facing pages that display user information will be delayed by I/O operations against LDAP.
Proposed resolution
Skip this downsync in user load. Then downsync the data regularly using cron.
Remaining tasks
Make the regularity configurable.
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3028122--update-on-cron.patch | 8.33 KB | karens |
| #8 | 3028122--update-on-cron.patch | 7.89 KB | karens |
| #7 | 3028122--update-on-cron.patch | 0 bytes | karens |
| #6 | 3028122--update-on-cron.patch | 7.52 KB | karens |
| #5 | 3028122--update-on-cron.patch | 4.83 KB | karens |
Comments
Comment #2
e0ipsoThis patch moves the downsync to a cron process completely. Now you can get your user synchronized by logging in or by cron.
Comment #3
e0ipsoComment #5
karens commentedI had a couple problems with this patch:
- The code at the beginning means this code is only executed once every 6 hours, no matter how often cron is run. It's already limited to running only when cron runs, which shouldn't be too often to hit a LDAP server. And it complicates attempts to fix a login if someone's account got blocked by confusing everyone about whether the LDAP credentials are broken or if the code just didn't run. I removed that restriction.
- The code pulls out a list of all users, then filters it using $authenticator->skipCheck($user), then checks to see if any accounts need to be unblocked. But that filter will remove all blocked users, so they will never get unblocked. I switched to use $authenticator->canAuthenticate($user->getUsername()) instead, which only filters out the anonymous user and user 1.
Comment #6
karens commentedAfter thinking more on this, there might be times when you want to restrict how often this is done, not because of any worry about the LDAP server but to reduce the hit on Drupal. For instance, if cron runs very frequently and LDAP users rarely change. So I added a configuration value for and worked it back in.
Comment #7
karens commentedComment #8
karens commentedComment #9
karens commentedA further tweak, add system messages to tell you who has been activated or blocked or that the update was skipped.
Comment #11
karens commented