Re: [web2py] Re: Permissions on records

2010-09-08 Thread Johann Spies
Thanks. That brings some light. I was trying to fit it into a controller. Regards Johann --     "Be not deceived; God is not mocked: for whatsoever a      man soweth, that shall he also reap."                                   Galatians 6:7

[web2py] Re: Permissions on records

2010-09-07 Thread mdipierro
The example below would go in a model. It must be executed before every action that accesses the db.comment table. In your code the onaccept is set in an action therefore only valid within the scope of the http request. On Sep 7, 3:08 pm, Johann Spies wrote: > Maybe I should rephrase my lack of u

Re: [web2py] Re: Permissions on records

2010-09-07 Thread Johann Spies
Maybe I should rephrase my lack of understanding. Can you explain the example from the book: = def give_create_permission(form): group_id = auth.id_group('user_%s' % auth.user.id) auth.add_permission(group_id, 'read', db.comment) auth.add_permission(group_id, 'create',

Re: [web2py] Re: Permissions on records

2010-09-07 Thread Johann Spies
Thanks for your answer. I am trying to understand. On 7 September 2010 16:48, mdipierro wrote: > It is a logic issue. ... > You do not want to register the callback with "register_onaccept". you > want to set these once for all: > >       auth.add_permission(group_id, 'read', table) >       auth

[web2py] Re: Permissions on records

2010-09-07 Thread mdipierro
It is a logic issue. This line does nothing: auth.settings.register_onaccept = (lambda form,table=table:give_create_permission(form,table)) You do not want to register the callback with "register_onaccept". you want to set these once for all: auth.add_permission(group_id, 'read', table)

Re: [web2py] Re: Permissions on records

2010-09-07 Thread Johann Spies
Is there anyone who can help me with this one please? Regards Johann --     "Be not deceived; God is not mocked: for whatsoever a      man soweth, that shall he also reap."                                   Galatians 6:7

Re: [web2py] Re: Permissions on records

2010-09-06 Thread Johann Spies
On 29 August 2010 07:05, mdipierro wrote: > almost: > > def give_create_permission(form,table): >        group_id = auth.id_group('user_%s' % auth.user.id) >        auth.add_permission(group_id, 'read', table) > > and > > auth.settings.register_onaccept = (lambda form, > table=table:give_create_pe

[web2py] Re: Permissions on records

2010-08-28 Thread mdipierro
almost: def give_create_permission(form,table): group_id = auth.id_group('user_%s' % auth.user.id) auth.add_permission(group_id, 'read', table) and auth.settings.register_onaccept = (lambda form, table=table:give_create_permission(form,table)) On Aug 28, 3:22 pm, Johann Spies