improve views and templates permissions managment

This commit is contained in:
Élie Bouttier 2014-09-01 23:40:00 -07:00
parent d27bebf58b
commit 7fc719c5d1
7 changed files with 266 additions and 156 deletions

View file

@ -7,7 +7,7 @@ from permissions.models import GlobalPermission
def user_has_perm(user, perm, perms):
for p in perms:
# this perm allow that action and the user is concerned by this perm
if hasattr(p, perm) and getattr(p, perm) and p.granted_to(user):
if perm in p.all_perms and getattr(p, perm) and p.granted_to(user):
return True