you can do

@auth.requires(auth.has_membership(auth.id_group('role1')) or
auth.has_membership(auth.id_group('role2')))

but this is not the right way to handle it.

You should add permissions:

auth.add_permission('run_this',group_id=id.group('role1'))
auth.add_permission('run_this',group_id=id.group('role2'))

and then check if user is a member of a group that has such
permissions

@auth.requires_permission('run_this')

On Sep 14, 8:09 am, Jose <[email protected]> wrote:
> Hi,
>
> I remember seeing the answer to my question, but because they are
> "lost" can not find it.
>
> I need to assign permissions to various roles in a function.
>
> This does not work:
> @auth.requires_membership(['role1', 'role2'])
> def myfunction():
>    return dict()
>
> This does not work:
> @auth.requires_membership('role1')
> @auth.requires_membership('role2')
> def myfunction():
>    return dict()
>
> How to do I need?
>
> Regards,
> Jose
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to