Problem/Motivation

The OrphanProcessor does not work atm.

Proposed resolution

Lets port it as is to D8 and improve it later.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webflo created an issue. See original summary.

webflo’s picture

+++ b/ldap_servers/src/OrphanProcessor.php
@@ -43,40 +44,39 @@ class OrphanProcessor {
-      \Drupal::configFactory()->getEditable('ldap_user.settings')->set('ldap_user_cron_last_uid_checked', 1)->save();

I moved the ldap_user_cron_last_uid_checked to the state system. Lets add an update hook to delete the old setting.

webflo’s picture

+++ b/ldap_servers/src/OrphanProcessor.php
@@ -154,34 +154,28 @@ class OrphanProcessor {
+          $account = User::load($user_data['uid']);
+          $account->ldap_user_last_checked->value = $check_time;
+          $account->save();

I think we shouldn't touch all user objects because this could lead to a lot of cache invalidation. The ldap_user_last_checked time it not used for the query and therefore not relevant.

grahl’s picture

Assigned: Unassigned » grahl

  • grahl committed 230cf26 on 8.x-3.x authored by webflo
    Issue #2841620 by webflo, grahl: Port OrphanProcessor to D8
    
grahl’s picture

Status: Needs review » Fixed

Thanks for starting to get ball rolling on this webflo!

I've finished porting the orphan processor and the mail functionality seems to work fine now, though I'm not convinced that this actually works properly on 7, since I've had to modify searchAllBaseDN slightly: The puid is often representative of the whole DN, a search across that within the base DN will in most cases likely return 0 results, thus this has to be stripped out. At least for the Docker test configuration this is the case.

There could be real-world configurations where that is not the case. If one of those turns up I'll add it as a new use case to testSearchAllBaseDns() but I'd require some feedback here.

I agree that in the previous configuration saving accounts was not ideal when ldap_user_last_checked was not taken into account. I've now added a field to the configuration which allows one to check daily, monthly, weekly or always thus this should now server an actual purpose. I'm open to suggestions if someone had a better solution.

Moving ldap_user_cron_last_uid_checked to state is a good solution, since we are still in alpha releases and the setting doesn't really hurt I'm not writing an update hook for that. If you think we really need that I'd accept another patch ;-)

I have not merged the first part of your patch modifying userPuidFromLdapEntry() since that's unrelated. Could you please add a separate ticket for that? I'd like to not add that without exactly knowing what side-effects this could have.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.