On Sep 10, 11:31 am, ron_m <ron.mco...@gmail.com> 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 with my alternative. It turns out many of
the symbolic names for permissions in my application were things like
'ManageUsers' so that can be split into 'Manage' and 'Users:' which
are placed in fields name and table_name for the action, object pair
that permissions is intended to represent. Using the IS_NULL_OR() put
a None into the table_name column table which is not the same as the
default parameter value of '' or empty string in the
requires_permission decorator resulting in the permission check
failing. It initially worked for me because I didn't re-enter the
values into the database so I had '' in the column but when I did an
update as part of testing it converted to None which won't work.

To disable the IS_IN_SET(db.tables) validator from the define_tables
function in the Auth class just place this line somewhere in your
model instead of editing tools.py.

db.auth_permission.table_name.requires = None

I also kept this line so I didn't have to think about record ids on
non-existent tables.

db.auth_permission.record_id.default = 0

Ron

Reply via email to