How to pre-assign roles to a user based on user emails with Authorization Extension?


I would like to pre-defined roles to some users based on the email list I have, so that whenever that person register an account it would automatically assigned to a role if their email match with one of my email list.

I’m using Authorization Extension to manage roles. Can anyone help me how to do this?


Can anyone help regarding this topic please?

I tried using rules to call authorization extension API to add user to a role, the problem with this method is that user who just register will not immediately get the access, instead the role will only appear after the 2nd login.

I also tried using hooks, I tried both post-registration and pre-registration.

For post registration, I don’t know why but my script to use the authorization extension API seems not executed properly. I can see from the log the it is indeed calling the API to assign the role to the user, but the user permission is not updated.

For pre registration, I can’t use it because in pre-registration script user_id does not exist, and this is needed for calling auth extension API for adding user to roles.