mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-26 07:22:34 +00:00
Merge pull request #725 from haiwen/perm-audit
update send perm audit msg function
This commit is contained in:
@@ -191,7 +191,7 @@ class DirSharedItemsEndpoint(APIView):
|
|||||||
shared_to, permission)
|
shared_to, permission)
|
||||||
|
|
||||||
send_perm_audit_msg('modify-repo-perm', username, shared_to,
|
send_perm_audit_msg('modify-repo-perm', username, shared_to,
|
||||||
shared_repo.id, path, permission)
|
repo_id, path, permission)
|
||||||
|
|
||||||
if shared_to_group:
|
if shared_to_group:
|
||||||
gid = request.GET.get('group_id')
|
gid = request.GET.get('group_id')
|
||||||
@@ -212,7 +212,7 @@ class DirSharedItemsEndpoint(APIView):
|
|||||||
permission)
|
permission)
|
||||||
|
|
||||||
send_perm_audit_msg('modify-repo-perm', username, gid,
|
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,
|
return HttpResponse(json.dumps({'success': True}), status=200,
|
||||||
content_type=json_content_type)
|
content_type=json_content_type)
|
||||||
@@ -278,7 +278,7 @@ class DirSharedItemsEndpoint(APIView):
|
|||||||
})
|
})
|
||||||
|
|
||||||
send_perm_audit_msg('add-repo-perm', username, to_user,
|
send_perm_audit_msg('add-repo-perm', username, to_user,
|
||||||
shared_repo.id, path, permission)
|
repo_id, path, permission)
|
||||||
except SearpcError as e:
|
except SearpcError as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
failed.append(to_user)
|
failed.append(to_user)
|
||||||
@@ -319,7 +319,7 @@ class DirSharedItemsEndpoint(APIView):
|
|||||||
})
|
})
|
||||||
|
|
||||||
send_perm_audit_msg('add-repo-perm', username, gid,
|
send_perm_audit_msg('add-repo-perm', username, gid,
|
||||||
shared_repo.id, path, permission)
|
repo_id, path, permission)
|
||||||
except SearpcError as e:
|
except SearpcError as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
failed.append(group.group_name)
|
failed.append(group.group_name)
|
||||||
@@ -370,7 +370,7 @@ class DirSharedItemsEndpoint(APIView):
|
|||||||
permission = seafile_api.check_permission_by_path(repo.id, path,
|
permission = seafile_api.check_permission_by_path(repo.id, path,
|
||||||
shared_to)
|
shared_to)
|
||||||
send_perm_audit_msg('delete-repo-perm', username, 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:
|
if shared_to_group:
|
||||||
group_id = request.GET.get('group_id')
|
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)
|
seafile_api.unset_group_repo(shared_repo.id, group_id, username)
|
||||||
|
|
||||||
send_perm_audit_msg('delete-repo-perm', username, group_id,
|
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,
|
return HttpResponse(json.dumps({'success': True}), status=200,
|
||||||
content_type=json_content_type)
|
content_type=json_content_type)
|
||||||
|
@@ -1211,10 +1211,12 @@ def send_perm_audit_msg(etype, from_user, to, repo_id, path, perm):
|
|||||||
"""Send repo permission audit msg.
|
"""Send repo permission audit msg.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
- `request`:
|
- `etype`: add/modify/delete-repo-perm
|
||||||
- `repo`:
|
- `from_user`: email
|
||||||
- `obj_id`:
|
- `to`: email or group_id or all(public)
|
||||||
- `dl_type`: web or api
|
- `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' % \
|
msg = 'perm-update\t%s\t%s\t%s\t%s\t%s\t%s' % \
|
||||||
(etype, from_user, to, repo_id, path, perm)
|
(etype, from_user, to, repo_id, path, perm)
|
||||||
|
Reference in New Issue
Block a user