0

While I have been able to use the LDAP authentication hook (hook_ldap_authentication_allowuser_results_alter) to perform additional authentication, I have not been able to use what I thought was the LDAP authorization hook (hook_ldap_authorization_maps_alter, defined in the LDAP authorization module, file ldap_authorization.api.php) - the hook never gets executed.

The purpose is to assign user roles to newly created, LDAP-authenticated accounts (therefore I need a Drupal ID). We can't currently use LDAP-Drupal user role mappings because our LDAP does not contain the necessary information to determine the role; instead we need to tap a different database to determine this, and I was hoping that there would a hook somewhere during account creation.

  • What version of Drupal are you using? Also have you looked into hook_user_presave (D7) or hook_user (D6) ? – Cravecode May 8 '13 at 17:16
  • I forgot to specify - Drupal 7. I did not know about hook_user_presave(), didn't realize it had changed from Drupal 6. No wonder hook_user() didn't work! Thanks, I will definitely try it, since I also need to be able to remove associated user data whenever a LDAP-authenticated user is removed, and needed a hook for it as well. – user14760 May 8 '13 at 18:42
0

I've been down this route a few times (looking at using LDAP integration module) each time I ended up writing my own LDAP integration. Everyone implements differently, I just take the pieces I like from the LDAP module out there (6 or 7) and use your own code to do it. As a general rule, anytime the rubber hits the road with integrating Drupal with user authentication / authorization systems in an organization I brute force them together via a custom / forked module. You'll always know your own auth system's specific needs, D.O. will not :)

|improve this answer|||||
  • thanks for the suggestion, I hope I won't have to go down this path for a while...;) – user14760 May 8 '13 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.