1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-30 13:23:14 +00:00

Merge pull request #1525 from haiwen/update-api-usage

update api usage
This commit is contained in:
xiez 2017-03-29 11:41:09 +08:00 committed by GitHub
commit e83b63d34c
5 changed files with 11 additions and 11 deletions

View File

@ -5,7 +5,7 @@ from rest_framework import status
from rest_framework.authentication import BaseAuthentication
from rest_framework.exceptions import APIException
import seaserv
from seaserv import ccnet_api
from seahub.base.accounts import User
from seahub.api2.models import Token, TokenV2
from seahub.api2.utils import get_client_ip
@ -78,7 +78,7 @@ class TokenAuthentication(BaseAuthentication):
raise AuthenticationFailed('User inactive or deleted')
if MULTI_TENANCY:
orgs = seaserv.get_orgs_by_user(token.user)
orgs = ccnet_api.get_orgs_by_user(token.user)
if orgs:
user.org = orgs[0]
@ -103,7 +103,7 @@ class TokenAuthentication(BaseAuthentication):
raise AuthenticationFailed('User inactive or deleted')
if MULTI_TENANCY:
orgs = seaserv.get_orgs_by_user(token.user)
orgs = ccnet_api.get_orgs_by_user(token.user)
if orgs:
user.org = orgs[0]

View File

@ -217,7 +217,7 @@ class User(object):
orgs = []
if is_pro_version():
orgs = ccnet_threaded_rpc.get_orgs_by_user(username)
orgs = ccnet_api.get_orgs_by_user(username)
# remove owned repos
owned_repos = []

View File

@ -5,7 +5,7 @@ from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
import seaserv
from seaserv import ccnet_api
from seahub.notifications.models import Notification
from seahub.notifications.utils import refresh_cache
@ -32,7 +32,7 @@ class BaseMiddleware(object):
request.cloud_mode = True
if MULTI_TENANCY:
orgs = seaserv.get_orgs_by_user(username)
orgs = ccnet_api.get_orgs_by_user(username)
if orgs:
request.user.org = orgs[0]
else:

View File

@ -1368,7 +1368,7 @@ def space_and_traffic(request):
username = request.user.username
# space & quota calculation
org = ccnet_threaded_rpc.get_orgs_by_user(username)
org = ccnet_api.get_orgs_by_user(username)
if not org:
space_quota = seafile_api.get_user_quota(username)
space_usage = seafile_api.get_user_self_usage(username)

View File

@ -132,7 +132,7 @@ def _populate_user_quota_usage(user):
Arguments:
- `user`:
"""
orgs = ccnet_threaded_rpc.get_orgs_by_user(user.email)
orgs = ccnet_api.get_orgs_by_user(user.email)
try:
if orgs:
user.org = orgs[0]
@ -502,7 +502,7 @@ def user_info(request, email):
org_name = None
space_quota = space_usage = 0
org = ccnet_threaded_rpc.get_orgs_by_user(email)
org = ccnet_api.get_orgs_by_user(email)
if not org:
owned_repos = mute_seafile_api.get_owned_repo_list(email,
ret_corrupted=True)
@ -646,7 +646,7 @@ def user_set_quota(request, email):
space_quota_mb = f.cleaned_data['space_quota']
space_quota = space_quota_mb * get_file_size_unit('MB')
org = ccnet_threaded_rpc.get_orgs_by_user(email)
org = ccnet_api.get_orgs_by_user(email)
try:
if not org:
seafile_api.set_user_quota(email, space_quota)
@ -702,7 +702,7 @@ def user_remove(request, email):
try:
user = User.objects.get(email=email)
org = ccnet_threaded_rpc.get_orgs_by_user(user.email)
org = ccnet_api.get_orgs_by_user(user.email)
if org:
if org[0].creator == user.email:
messages.error(request, _(u'Failed to delete: the user is an organization creator'))