0

I'm currently working on a custom module which holds a list of organization IDs that will be used to match with an attribute I get from a SAML idP response.

I'm currently using the saml_sp SAML Service Provider module which has hooks/functions for finding the Drupal user and log it in, otherwise create a new user if none exists with that email.

I need to check if the org. ID matches any of the IDs in my custom module's table entries instead, so there's a substantial amount of modifications needed to change this workflow.

Preferably, I wish not to do any modifications to the saml_sp code as future updates of that module or fresh installations would cause havoc and the login won't work.

Is there a way to bypass saml_sp's hooks/functions so that my custom module can "take over" once the particular hook/function in saml_sp gets called?

There seems to be a lot of mixed opinions about this. Personally I don't see the point in not being able to do this, as the typical Drupal installation consist of an orgy of modules and they should all be able manipulate each other, right? Or am I missing another simpler solution to the problem?

| improve this question | | | | |
  • What function(s) specifically do you want to replace? – Clive Dec 12 '18 at 13:50
  • That module does not look like it offers much in the way of hooks or alter functions. – Kevin Dec 12 '18 at 14:14
0

In general, if a module does not provide a hook, some other will do. You could check if some hook in core fits to what you need to do. Depending on what is the final result of your data change, you could perform it after a module generates the data to be changed, and before the data gets saved, for example. By another hand if a module already uses the same hook you want to use it is still possible to rely on the weight of your module to be sure it will run afterwards. By the description of your specific requirements (login a user and create a user) hook_user_login and hook_user_presave could be used.

| improve this answer | | | | |

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.