Commit 8fc5db79 authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier

fix: json-ldp permissions @type on parent containers

parent d56827ad
Pipeline #4890 passed with stage
in 1 minute and 21 seconds
......@@ -42,9 +42,13 @@ class LDPPermissions(BasePermission):
else:
return authenticated_perms
def filter_user_perms(self, user_or_group, obj, permissions):
def filter_user_perms(self, user, model, permissions):
# Only used on Model.get_permissions to translate permissions to LDP
return [perm for perm in permissions if perm in self.user_permissions(user_or_group, obj)]
if hasattr(model._meta, 'owner_field'):
obj = model
else:
obj = None
return [perm for perm in permissions if perm in self.user_permissions(user, model, obj)]
perms_map = {
......@@ -102,4 +106,4 @@ class LDPPermissions(BasePermission):
if not perm.split('.')[1].split('_')[0] in self.user_permissions(request.user, model, obj):
return False
return True
return True
\ No newline at end of file
Markdown is supported
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