Add method to grant and revoke access via ACLs.

Granting will also check if the permission has been
authorized to the object class using ModelPermission.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2017-07-17 20:39:41 -04:00
parent 804b077115
commit 3cbe90567f
3 changed files with 70 additions and 25 deletions

View File

@@ -26,6 +26,10 @@ class ModelPermission(object):
model.add_to_class('acls', GenericRelation(AccessControlList))
@classmethod
def get_for_class(cls, klass):
return cls._registry.get(klass, ())
@classmethod
def get_for_instance(cls, instance):
StoredPermission = apps.get_model(