[shib_auth] Hook when user account is created

Markus Broman brom at dsv.su.se
Thu May 5 12:07:46 CEST 2011


On 3 maj 2011, at 17.35, Kristof Bajnok wrote:

> On Tuesday 03 May 2011 10:51:37 Markus Broman wrote:
>> I'm trying to assign roles to users upon login, depending on a http request
>> I make from a custom module.
>> 
>> What I want is to hook onto hook_user and if case: "insert", add roles to
>> the user. So that when the user logs in the first time he belongs to the
>> roles. This doesn't work. 
> 
> This _should_ work. If you are sure that the insert run is not run on 
> registering a new user, then this is a bug, please report it. 
> 
> In fact, it is user_external_login_register() which calls user_save(), which 
> calls 'insert' hook on creating new users. 

Okay, I have tried to get insert and update to run but it wont. The problem was that I needed the users mail for the http request but $account doesn't seem to contain $account[mail] the first time he logs in. I have changed the request now so that it sends username instead.

Thanks for the help, I will report the insert issue as a bug.

// Markus

> 
>> Is there a hook or something in Shibboleth authentication where I can make
>> these changes?
> 
> The module should call normal user hooks: insert, login, after_update. If it 
> fails to call them, then this is most probably a bug. 
> 
> Kristof
> 
> _______________________________________________
> shib_auth mailing list
> shib_auth at listserv.niif.hu
> https://listserv.niif.hu/mailman/listinfo/shib_auth




More information about the shib_auth mailing list