To use a conditions based in values use:

@auth.require(conditions)

http://web2py.com/books/default/chapter/29/09/access-control#Combining-requirements

And to use many values in conditions I guess that this solve your problem:

role_names = ["admin","supervisor","auditor"]
@auth_requires(any( auth.has_membership(role) for role in role_names) ) ]

This statement above means that current logged user be admin OR supervisor 
OR autidor.

To satisfy all roles replace ANY by ALL


ps. I don't tested.


Em quinta-feira, 10 de novembro de 2016 13:50:02 UTC-3, Ramos escreveu:
>
> i have a row in a table that want to protect from users
> i have the field  as list:string like this 
> ->["admin","supervisor","auditor"]
>
> with auth_requiresmembership(role) i need role to be  string , not a list.
>
> what is the best solution here?
>
> regards
> António
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to