ACL app updates

Update the ACL permission view to use the new AddRemoveView.

Add ACL created and ACL edit events.

Add permission adding and removal accesors to the ACL model.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-02-14 02:30:51 -04:00
parent 6a57a5a7de
commit 18e5ee1e4f
5 changed files with 132 additions and 102 deletions

View File

@@ -151,7 +151,7 @@ class AccessControlListManager(models.Manager):
else:
raise PermissionDenied
def get_inherited_permissions(self, role, obj):
def get_inherited_permissions(self, obj, role):
try:
instance = obj.first()
except AttributeError:
@@ -177,11 +177,11 @@ class AccessControlListManager(models.Manager):
parent_object = return_related(
instance=instance, related_field=parent_accessor
)
content_type = ContentType.objects.get_for_model(parent_object)
content_type = ContentType.objects.get_for_model(model=parent_object)
try:
return self.get(
role=role, content_type=content_type,
object_id=parent_object.pk
content_type=content_type, object_id=parent_object.pk,
role=role
).permissions.all()
except self.model.DoesNotExist:
return StoredPermission.objects.none()