优化添加苹果开发者账号逻辑

dependabot/npm_and_yarn/fir_admin/url-parse-1.5.10
nineven 3 years ago
parent 192d4cadc0
commit 3d2ce3b73d
  1. 2
      fir_admin/src/views/wxbind/list.vue
  2. 19
      fir_ser/api/views/supersign.py

@ -92,7 +92,7 @@
</template> </template>
<script> <script>
import { getWxBindInfos, deleteWxBind, getWxBindList } from '@/api/wxbind' import { deleteWxBind, getWxBindList } from '@/api/wxbind'
import { baseFilter } from '@/utils' import { baseFilter } from '@/utils'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import waves from '@/directive/waves' // waves directive import waves from '@/directive/waves' // waves directive

@ -29,6 +29,15 @@ from fir_ser.settings import DEVELOPER_USE_STATUS, DEVELOPER_DISABLED_STATUS
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def delete_developer_and_clean(developer_obj, user_obj):
if developer_obj and user_obj:
logger.error(f"user {user_obj} delete developer {developer_obj}")
if developer_obj.certid:
IosUtils.clean_developer(developer_obj, user_obj)
IosUtils.revoke_developer_cert(developer_obj, user_obj)
developer_obj.delete()
class DeveloperView(APIView): class DeveloperView(APIView):
authentication_classes = [ExpiringTokenAuthentication, ] authentication_classes = [ExpiringTokenAuthentication, ]
permission_classes = [SuperSignPermission, ] permission_classes = [SuperSignPermission, ]
@ -242,6 +251,7 @@ class DeveloperView(APIView):
if not status: if not status:
res.code = 1008 res.code = 1008
res.msg = result.get("return_info", "未知错误") res.msg = result.get("return_info", "未知错误")
delete_developer_and_clean(developer_obj, request.user)
return Response(res.dict) return Response(res.dict)
else: else:
IosUtils.get_device_from_developer(developer_obj) IosUtils.get_device_from_developer(developer_obj)
@ -260,14 +270,7 @@ class DeveloperView(APIView):
developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=request.user, issuer_id=issuer_id).first() developer_obj = AppIOSDeveloperInfo.objects.filter(user_id=request.user, issuer_id=issuer_id).first()
else: else:
return self.get(request) return self.get(request)
delete_developer_and_clean(developer_obj, request.user)
if developer_obj:
logger.error(f"user {request.user} delete developer {developer_obj}")
if developer_obj.certid:
IosUtils.clean_developer(developer_obj, request.user)
IosUtils.revoke_developer_cert(developer_obj, request.user)
developer_obj.delete()
return self.get(request) return self.get(request)

Loading…
Cancel
Save