So a quick google on the google group shows that auth.user_id is the variable I 
am looking for. 

I am really sorry for spamming the list for this simple question. Will search 
more thoroughly next time.


----- Original Message ----
> From: Luther Goh Lu Feng <elf...@yahoo.com>
> To: web2py <web2py@googlegroups.com>
> Sent: Wed, October 20, 2010 1:52:19 PM
> Subject: Getting the user id for login redirect
> 
> Good day,
> 
> I am trying to construct a login system that redirects the  login to 
> different 

> controllers depending on which membership they belong to.  Below is the code 
> snippet. I need some tips to access the variable  containing the user id. I 
> believe I might need to look at a session  variable.  If there are any other 
> 
> @auth.requires_login()
> def  index():
>     """
>     Redirects user to the appropriate  controller based on the group user 
>belongs 
>
> to
>     """
>      membership =  db.auth_membership(user_id=SOME_SESSION_USER_VARIABLE)
>     if  membership.group_id == 2:
>          redirect(URL(f=workspace))
>     elif membership.group_id ==  3:
>          redirect(URL(f=dashboard))
> 
> 
> 
>       
> 


      

Reply via email to