diff --git a/seahub/api2/endpoints/dir_shared_items.py b/seahub/api2/endpoints/dir_shared_items.py index 28e5d85bd9..e8350db8f8 100644 --- a/seahub/api2/endpoints/dir_shared_items.py +++ b/seahub/api2/endpoints/dir_shared_items.py @@ -191,7 +191,7 @@ class DirSharedItemsEndpoint(APIView): shared_to, permission) send_perm_audit_msg('modify-repo-perm', username, shared_to, - shared_repo.id, path, permission) + repo_id, path, permission) if shared_to_group: gid = request.GET.get('group_id') @@ -212,7 +212,7 @@ class DirSharedItemsEndpoint(APIView): permission) send_perm_audit_msg('modify-repo-perm', username, gid, - shared_repo.id, path, permission) + repo_id, path, permission) return HttpResponse(json.dumps({'success': True}), status=200, content_type=json_content_type) @@ -278,7 +278,7 @@ class DirSharedItemsEndpoint(APIView): }) send_perm_audit_msg('add-repo-perm', username, to_user, - shared_repo.id, path, permission) + repo_id, path, permission) except SearpcError as e: logger.error(e) failed.append(to_user) @@ -319,7 +319,7 @@ class DirSharedItemsEndpoint(APIView): }) send_perm_audit_msg('add-repo-perm', username, gid, - shared_repo.id, path, permission) + repo_id, path, permission) except SearpcError as e: logger.error(e) failed.append(group.group_name) @@ -370,7 +370,7 @@ class DirSharedItemsEndpoint(APIView): permission = seafile_api.check_permission_by_path(repo.id, path, shared_to) send_perm_audit_msg('delete-repo-perm', username, shared_to, - shared_repo.id, path, permission) + repo_id, path, permission) if shared_to_group: group_id = request.GET.get('group_id') @@ -393,7 +393,7 @@ class DirSharedItemsEndpoint(APIView): seafile_api.unset_group_repo(shared_repo.id, group_id, username) send_perm_audit_msg('delete-repo-perm', username, group_id, - shared_repo.id, path, permission) + repo_id, path, permission) return HttpResponse(json.dumps({'success': True}), status=200, content_type=json_content_type) diff --git a/seahub/utils/__init__.py b/seahub/utils/__init__.py index 33bad389e6..f6cc0a1df3 100644 --- a/seahub/utils/__init__.py +++ b/seahub/utils/__init__.py @@ -1211,10 +1211,12 @@ def send_perm_audit_msg(etype, from_user, to, repo_id, path, perm): """Send repo permission audit msg. Arguments: - - `request`: - - `repo`: - - `obj_id`: - - `dl_type`: web or api + - `etype`: add/modify/delete-repo-perm + - `from_user`: email + - `to`: email or group_id or all(public) + - `repo_id`: origin repo id + - `path`: dir path + - `perm`: r or rw """ msg = 'perm-update\t%s\t%s\t%s\t%s\t%s\t%s' % \ (etype, from_user, to, repo_id, path, perm)