django custom groups and custom permissions -


i'm creating cms , facing issue need advice. have few different modules (apps) can define custom permission them - in model define custom permissions "view_store", "edit_store", "delete_store" , on. , have defined different user groups (i want have group based user access control) - admin, editor, vip, user.

i'm creating these groups when running 1 time command initialize cms (manage.py initcms) , want of course right permissions added group in same time.

initcms action running after syncdb, models in db (info permissions of course).

i have in mind... if way go or have better one? let me describe mine: want give example vip user permission models (which have permission defined) "view_*". means vip can view everything. have idea when initializing database grab entries (all permissions) fits pattern "like view_%" , add these group's permissions.

but problem if new module added... need re-run action , check if permissions right... maybe there dynamic way deal group permissions?

any kind of information welcome :)

ignas

one possible solution use django signals, can triggered before or after model's save mothod has been called or after or before m2m action takes places, after syncdb etc... may select proper signal fits best , call function checks related permissions , add or remove if necessary...


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -