Record events for permission changes

This commit is contained in:
Arik Fraimovich
2016-10-26 11:47:57 +03:00
parent df17759ab4
commit 9cb9bdb515

View File

@@ -55,6 +55,14 @@ class ObjectPermissionsListResource(BaseResource):
permission = AccessPermission.grant(obj, access_type, grantee, self.current_user)
self.record_event({
'action': 'grant_permission',
'object_id': object_id,
'object_type': object_type,
'access_type': access_type,
'grantee': grantee.id
})
return permission.to_dict()
def delete(self, object_type, object_id):
@@ -69,6 +77,14 @@ class ObjectPermissionsListResource(BaseResource):
AccessPermission.revoke(obj, grantee, access_type)
self.record_event({
'action': 'revoke_permission',
'object_id': object_id,
'object_type': object_type,
'access_type': access_type,
'grantee': grantee.id
})
class CheckPermissionResource(BaseResource):
def get(self, object_type, object_id, access_type):