From 9cb9bdb515014ec152bba22730839edea2a910fc Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Wed, 26 Oct 2016 11:47:57 +0300 Subject: [PATCH] Record events for permission changes --- redash/handlers/permissions.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/redash/handlers/permissions.py b/redash/handlers/permissions.py index 71552c361..d0a05aff1 100644 --- a/redash/handlers/permissions.py +++ b/redash/handlers/permissions.py @@ -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):