Test an object's parent for permission but also test the child object if the parent test fails.
This commit is contained in:
@@ -64,7 +64,12 @@ class AccessControlListManager(models.Manager):
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
obj = getattr(obj, parent_accessor)
|
||||
try:
|
||||
return self.check_access(
|
||||
permissions, user, getattr(obj, parent_accessor)
|
||||
)
|
||||
except PermissionDenied:
|
||||
pass
|
||||
|
||||
user_roles = []
|
||||
for group in user.groups.all():
|
||||
|
||||
Reference in New Issue
Block a user