On May 15, 9:52 am, annet <annet.verm...@gmail.com> wrote:
> I defined a custom user table and created a few users. Then, I created
> two groups: core and site, made the users members of these groups and
> assigned permissions to the groups. Doing this raised the following
> questions:
>
> Is it possible to combine decorators? e.g. executing a function
> requires login and membership of the group 'site'.

You can always add one decorator after nother but mind that
@auth.requires_membership and @auth.requires_permission
already check whether the user is logged in or not.

> When do I use @auth.requires_permission() or auth.has_permission
> ('create','adres'):

You use the decorator @auth.requires_mermission to prevent a function
to be called without permission.
You use has_permission to check (get a boolean) in the funciton to add
your own logic. In this latter case you can check any user (the third
argument is the user_id). When user_id==0 then it is the current
logged in user.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to