1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-10-20 18:32:41 +00:00

add org check login when share repo to group (#8155)

This commit is contained in:
lian
2025-08-22 09:30:25 +08:00
committed by GitHub
parent 2ed7b39394
commit 800353c7d3

View File

@@ -491,13 +491,25 @@ class DirSharedItemsEndpoint(APIView):
if is_org_context(request):
# when calling seafile API to share authority related functions,
# change the uesrname to repo owner.
repo_owner = seafile_api.get_org_repo_owner(repo_id)
org_id = request.user.org.org_id
if org_id != ccnet_api.get_org_id_by_group(gid):
result['failed'].append({
'group_name': group.group_name,
'error_msg': "Current user's ornganization is not the same as the group's"
})
continue
repo_owner = seafile_api.get_org_repo_owner(repo_id)
share_dir_to_group(repo, path, repo_owner, username, gid, permission, org_id)
else:
repo_owner = seafile_api.get_repo_owner(repo_id)
if ccnet_api.get_org_id_by_group(gid) > 0:
result['failed'].append({
'group_name': group.group_name,
'error_msg': "The group is an organization group"
})
continue
repo_owner = seafile_api.get_repo_owner(repo_id)
share_dir_to_group(repo, path, repo_owner, username, gid, permission, None)
result['success'].append({