Hi Anthony,

Thanks for your solution !  Works perfect !

I have implemented it like this :

def redirect_after_login(form):

        if auth.has_membership(user_id=auth.user.id,role='Straathoekwerkers'):
                redirect(URL(r=request,f='mycla'))
                
        elif auth.has_membership(user_id=auth.user.id,role='Managers'):
                redirect(URL(r=request,c='management',f='user'))

        else:redirect(URL(r=request,c='management',f='value'))

auth.settings.login_onaccept.append(redirect_after_login)

Thanks

Mathias

2012/7/21 Anthony <[email protected]>:
> One option might be to set an auth.settings.login_onaccept callback and do
> the redirect in the callback.
>
> Anthony
>
>
> On Saturday, July 21, 2012 3:57:27 PM UTC-4, Mathias wrote:
>>
>> Hi,
>>
>> Depending on the role of the logged in user, the next URL should be
>> different.
>>
>> This is what I did :
>>
>> if auth.has_membership(user_id='6',role='Straathoekwerkers'):
>> auth.settings.login_next=URL('mycla')
>>
>> This works as long as I pass a user id, like I did in this piece of code.
>>
>> I am looking for a solution whereby anyone, with role 'Straathoekwerkers',
>> will be redirected to this URL.
>>
>> How can I do this ? If I don't pass a user id, it doesn't work.
>>
>> Thanks
>>
>> Mathias
>>
>>
> --
>
>
>

-- 



Reply via email to