1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-03 13:46:58 +00:00

[permission] Only split permission up to 3

This commit is contained in:
Benjamin Graillot 2020-03-07 11:21:19 +01:00
parent 5df1f42f43
commit 9d61e217e9

View File

@ -21,7 +21,7 @@ class PermissionBackend(object):
def has_perm(self, user_obj, perm, obj=None):
if obj is None:
return False
perm = perm.split('_')
perm = perm.split('_', 3)
perm_type = perm[1]
perm_field = perm[2] if len(perm) == 3 else None
return any(permission.applies(obj, perm_type, perm_field) for obj in self.permissions(user_obj, obj))