1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 06:33:48 +00:00

add MULTI_TENANCY check when admin transfer a repo

This commit is contained in:
lian
2016-08-20 11:12:15 +08:00
parent b66e1b8364
commit 0ed0919599
2 changed files with 30 additions and 26 deletions

View File

@@ -1523,18 +1523,19 @@ def sys_repo_transfer(request):
messages.error(request, _(u'Failed to transfer, user %s not found') % new_owner)
return HttpResponseRedirect(next)
try:
if seafserv_threaded_rpc.get_org_id_by_repo_id(repo_id) > 0:
messages.error(request, _(u'Can not transfer organization library'))
return HttpResponseRedirect(next)
if MULTI_TENANCY:
try:
if seafserv_threaded_rpc.get_org_id_by_repo_id(repo_id) > 0:
messages.error(request, _(u'Can not transfer organization library'))
return HttpResponseRedirect(next)
if ccnet_api.get_orgs_by_user(new_owner):
messages.error(request, _(u'Can not transfer library to organization user %s') % new_owner)
if ccnet_api.get_orgs_by_user(new_owner):
messages.error(request, _(u'Can not transfer library to organization user %s') % new_owner)
return HttpResponseRedirect(next)
except Exception as e:
logger.error(e)
messages.error(request, 'Internal Server Error')
return HttpResponseRedirect(next)
except Exception as e:
logger.error(e)
messages.error(request, 'Internal Server Error')
return HttpResponseRedirect(next)
repo_owner = seafile_api.get_repo_owner(repo_id)
@@ -1578,8 +1579,7 @@ def sys_repo_transfer(request):
if repo_id != pub_repo.id:
continue
seaserv.seafserv_threaded_rpc.set_inner_pub_repo(
repo_id, pub_repo.permission)
seafile_api.add_inner_pub_repo(repo_id, pub_repo.permission)
break