On Dec 12, 10:58 pm, cjrh <caleb.hatti...@gmail.com> wrote:
> On Dec 11, 7:44 pm, Luther Goh Lu Feng <elf...@yahoo.com> wrote:
>
> > Line 8 of code snippet should be
> > @auth.requires_membership('agents')
> > not
> > @auth.requires_membership(agents)
>
> Are you sure?   I haven't tried it out myself, but I note that in a
> subsequent line:
>
> @auth.requires_permission('read', secrets)
> def function_four():
>
> The secrets table is referred to directly, not passed as a table name
> string.  I would be surprised if the agents role is required to be
> passed as a string, but the tables are passed as objects.  If you tell
> me you wrote out the example code and it only works if you passed the
> role by name as 'agents', then that'll be good enough for me and I'll
> fix the example.

Hmm, I actually deployed an app that uses that method:

https://github.com/elfgoh/mustardjuice/blob/master/web2py/applications/mustardjuice/controllers/default.py

@auth.requires_membership('admin') worked but not
@auth.requires_membership(admin) (Line 56, 61)

Reply via email to