Global Permissions (not model associated)
by Brian Bouterse
My only complaint of the custom django
permissions<http://docs.djangoproject.com/en/dev/topics/auth/#id2>is
that they have to be associated with a model itself. Put another way,
there isn't a good way to declare permissions above the model layer, say if
a permission would involve multiple models. I finally found someone with a
pretty good solution to this problem:
http://www.djangosnippets.org/snippets/334/
Basically, this code creates a custom "content type" named after the
application itself, and then associates all permissions with that. This
still isn't ideal because a content type still exists for the Permission,
but at least it's a little better. It would also work well with a
meaningful app name.
For example, the vdi application could have a Permission named 'Manage' or
'View Reports' to indicate a whole bunch of different role-type access
permissions that are meaningful at the application level.
My only question is where do the statements that declare the permissions
live such that they only get called once on startup? It seems the code
wouldn't have any problems if it were run multiple times, but once is all we
need. Maybe we could put the permission registration code in a file that is
parsed once at startup, maybe similar to the admin.py? Does anyone know
specifically where to put this code so that it gets run once?
Best,
Brian
--
Brian Bouterse
ITng Services
14 years
trying to view apache error log
by Dennis Kliban
I am trying to view the apache log, but for some reason I cannot sudo. Maybe
I am doing it wrong. I've always just typed "sudo" then I would get prompted
for password. Or I would type "sudo [username]" and then get prompted for
username. This is apparently not correct usage. I've looked at the man page
and didn't get much help. What am I doing wrong?
Also, I finally pulled from the repository. When I try to import core, I am
told that the module does not exist.
Thanks,
Dennis
14 years