mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-30 13:23:14 +00:00
commit
e83b63d34c
@ -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]
|
||||
|
||||
|
@ -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 = []
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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'))
|
||||
|
Loading…
Reference in New Issue
Block a user