Commit 8ec0f319 authored by HERBERT Ryan's avatar HERBERT Ryan
Browse files

VidjilAuth.py check permission exists

Altered method get_permission to be able to check the existance of a
permission. ie passing no record id to get_permissions now works just
like in the old system
parent b739bcbd
......@@ -86,9 +86,12 @@ class VidjilAuth(Auth):
if not key in self.permissions and is_current_user:
self.permissions[key] = {}
if not is_current_user or not id in self.permissions[key]:
access_groups = self.get_access_groups(object_of_action, id, user)
perm_groups = self.get_permission_groups(action, object_of_action, user)
intersection = set(access_groups).intersection(perm_groups)
if id > 0:
access_groups = self.get_access_groups(object_of_action, id, user)
intersection = set(access_groups).intersection(perm_groups)
else :
intersection = perm_groups
if not is_current_user:
return len(intersection) > 0
self.permissions[key][id] = len(intersection) > 0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment