1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 21:07:17 +00:00

add get all departments api

This commit is contained in:
王健辉
2019-05-09 21:26:20 +08:00
parent 3b60ab2b67
commit 60034a0dae
4 changed files with 81 additions and 3 deletions

View File

@@ -1586,9 +1586,14 @@ class RepoOwner(APIView):
error_msg = 'Email %s invalid.' % new_owner
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
else:
seafile_api.set_repo_owner(repo_id, new_owner)
if '@seafile_group' in new_owner:
group_id = int(new_owner.split('@')[0])
seafile_api.transfer_repo_to_group(repo_id, group_id, '')
else:
seafile_api.set_repo_owner(repo_id, new_owner)
except SearpcError as e:
logger.error(e)
print e
error_msg = 'Internal Server Error'
return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg)