[web2py] Re: permissions question

2019-10-08 Thread Yoel Benitez Fonseca
After a dive in gluon/tools.py And a lot of try and errors this is what i came up to: https://gist.github.com/ybenitezf/5e66627c668813886f9da60f67aef5e9 maybe is not the best way El viernes, 27 de septiembre de 2019, 15:55:47 (UTC-4), Yoel Benitez Fonseca escribió: > > h! > > With `auth.acce

[web2py] Re: permissions question

2019-10-06 Thread Dave S
On Friday, September 27, 2019 at 12:55:47 PM UTC-7, Yoel Benitez Fonseca wrote: > > h! > > With `auth.accessible_query` u get the rows accessible to a user, how to > do the inverse ? > > I want to know the users who have a given permission > Try auth.has_membership(group_id='agents') , per th

[web2py] Re: permissions problems on ubuntu 11.10

2012-01-19 Thread Likit
Solved. Needed to add the www-data group to the location where I installed web2py and to phpmyadmin. Everything works as I want it to including a little static file served by apache to make sure the server is up, access via ssl to phpmyadmin, access to the test app for wsgi to make sure wsgi is r

[web2py] Re: permissions

2010-09-10 Thread ron_m
On Sep 10, 11:31 am, ron_m wrote: > Thanks Massimo, > > I added the lines > > db.auth_permission.table_name.requires = > IS_NULL_OR(IS_IN_SET(db.tables)) > db.auth_permission.record_id.default = 0 > It is much better to follow what Massimo was saying earlier in this thread after working a bit wit

[web2py] Re: permissions

2010-09-10 Thread ron_m
Thanks Massimo, I added the lines db.auth_permission.table_name.requires = IS_NULL_OR(IS_IN_SET(db.tables)) db.auth_permission.record_id.default = 0 to the end of my last model file which seems to work for what I need as well. The table name is allowed to be empty and the record_id defaults to

[web2py] Re: permissions

2010-09-10 Thread mdipierro
I would just turn off table.table_name.requires = IS_IN_SET(self.db.tables) and use a dummy table name for the permission (without creating the dummy table) and use a table name that cannot create conflict for example something that include a special symbol like ":" On Sep 10, 1:06 pm, ron_m

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

[web2py] Re: Permissions and appadmin question

2010-05-27 Thread mdipierro
Now I understand. Add this at the end of your db.py db.auth_permission.table_name.requires = IS_IN_SET(db.tables) You can specify the list of tables you want to give permissions on. On May 27, 12:48 pm, David Marko wrote: > Yes, I just created a new app in web2py and added my model at the end >

[web2py] Re: Permissions and appadmin question

2010-05-27 Thread David Marko
Yes, I just created a new app in web2py and added my model at the end of db.py . I can see my table in list of tables in database admin, I can even create new records. I cant see this table name in list of tables when adding the new auth_permission usin appadmin. Combo box with tables names contai

[web2py] Re: Permissions and appadmin question

2010-05-27 Thread mdipierro
Not sure about the problem. If you set crud.settings.auth=auth you have no permission on any table (via crud) unless you explicitely say so. But this does not affect appadmin. The problem may be where you define the table. Is that done in a model? Are you sure that is done after db.py? On May 27