修复管理员迁移失败问题

pull/15/head
youngS 4 years ago
parent 0df8cf68be
commit 04fe7a2965
  1. 2
      fir_ser/api/utils/storage/storage.py
  2. 6
      fir_ser/api/utils/utils.py
  3. 33
      fir_ser/api/views/login.py
  4. 2
      fir_ser/api/views/receiveudids.py

@ -113,7 +113,7 @@ class Storage(object):
def get_default_storage(self, user, storage_obj, use_default_storage): def get_default_storage(self, user, storage_obj, use_default_storage):
admin_obj = UserInfo.objects.filter(is_superuser=True).order_by('pk').first() admin_obj = UserInfo.objects.filter(is_superuser=True).order_by('pk').first()
if admin_obj and admin_obj.storage: if admin_obj and admin_obj.storage and admin_obj.pk != user.pk:
logger.info("user %s has not storage obj, from admin " logger.info("user %s has not storage obj, from admin "
"get default storage" % user) "get default storage" % user)
return self.get_storage(admin_obj, storage_obj, use_default_storage) return self.get_storage(admin_obj, storage_obj, use_default_storage)

@ -172,8 +172,10 @@ def delete_app_screenshots_files(storage_obj, app_obj):
screenshot_obj.delete() screenshot_obj.delete()
def change_storage_and_change_head_img(user_obj, new_storage_obj): def change_storage_and_change_head_img(user_obj, new_storage_obj, clean_old_data=True):
migrating_storage_file_data(user_obj, user_obj.head_img, new_storage_obj) if user_obj.head_img == 'head_img.jpeg':
clean_old_data = False
migrating_storage_file_data(user_obj, user_obj.head_img, new_storage_obj, clean_old_data)
def download_files_form_oss(storage_obj, org_file): def download_files_form_oss(storage_obj, org_file):

@ -430,39 +430,6 @@ class UserInfoView(APIView):
res.code = 1004 res.code = 1004
res.msg = "老密码校验失败" res.msg = "老密码校验失败"
else: else:
# # 修改个人资料
# domain_name = data.get("domain_name", None)
# if domain_name:
# domain_name_list = domain_name.strip(' ').replace("http://", "").replace("https://", "").split("/")
# if len(domain_name_list) > 0:
# domain_name = domain_name_list[0]
# if len(domain_name) > 3 and is_valid_domain(domain_name):
# if domain_name == SERVER_DOMAIN.get("REDIRECT_UDID_DOMAIN").split("//")[1]:
# user_admin_obj = UserInfo.objects.filter(is_superuser=True, uid=request.user.uid).order_by(
# 'pk').first()
# if user_admin_obj:
# request.user.domain_name = domain_name
# set_default_app_wx_easy(request.user, True)
# else:
# serializer = UserInfoSerializer(request.user)
# res.data = serializer.data
# res.code = 1004
# res.msg = "域名设置失败,请更换其他域名"
# return Response(res.dict)
# else:
# request.user.domain_name = domain_name
# set_default_app_wx_easy(request.user, True)
# else:
# serializer = UserInfoSerializer(request.user)
# res.data = serializer.data
# res.code = 1004
# res.msg = "域名校验失败"
# return Response(res.dict)
#
# if domain_name == '':
# request.user.domain_name = None
# set_default_app_wx_easy(request.user)
username = data.get("username", None) username = data.get("username", None)
if username and username != request.user.username: if username and username != request.user.username:
if check_username_exists(username): if check_username_exists(username):

@ -4,7 +4,7 @@
# author: liuyu # author: liuyu
# date: 2020/3/6 # date: 2020/3/6
from api.utils.app.supersignutils import udid_bytes_to_dict, get_redirect_server_domain, IosUtils from api.utils.app.supersignutils import udid_bytes_to_dict, get_redirect_server_domain
from api.models import Apps from api.models import Apps
from django.views import View from django.views import View
from django.http import HttpResponsePermanentRedirect from django.http import HttpResponsePermanentRedirect

Loading…
Cancel
Save