[Grok-dev] defining permissions in a module
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Mon Jul 23 09:49:22 EDT 2007
Hi,
In my application it sorta felt logical to define permissions in one
module and to reuse these permission in the modules of the
application. Something like:
permissions.py:
import grok
...
ADD_FOO = 'myappprefix.add_foo'
EDIT_FOO = 'myappprefix.edit_foo'
...
grok.
model.py:
import grok
import permissions
...
EditFoo(grok.View):
...
grok.require(permissions.EDIT_FOO)
Now, this only works if the permissions.py module is grokkked *before*
the module.py, which, if they're in the same package is not the case
(due to alphabetical order I guess).
Now, I do not really see a solution to this problem actually. I don't
think the grokkking process can grow a sort of "order resolution"
issues like these (but I'm really not sure).
But at least now you know of this limitation - or are there actullay
better ways to keep permissions in a central place?
kind regards,
jw
--
Jan-Wijbrand Kolman
More information about the Grok-dev
mailing list