修改p12 证书导入逻辑

dependabot/npm_and_yarn/fir_admin/ws-5.2.3
youngS 3 years ago
parent d4e4e9b278
commit 86d5623437
  1. 2
      fir_client/src/components/user/FirSuperSignBase.vue
  2. 15
      fir_ser/api/utils/app/iossignapi.py
  3. 11
      fir_ser/api/utils/app/supersignutils.py
  4. 12
      fir_ser/api/views/supersign.py

@ -147,7 +147,7 @@
<template slot-scope="scope">
<el-button v-if="scope.row.is_actived === true" type="success" size="small">已激活</el-button>
<el-button v-else type="danger" size="small"
@click="activedeveloperFun(scope.row,'preactive')">点击激活
@click="activedeveloperFun(scope.row,'checkauth')">点击激活
</el-button>
</template>

@ -202,6 +202,21 @@ class AppDeveloperApiV2(object):
result['return_info'] = "%s" % e
return False, result
def get_cert_obj_by_cid(self, cert_id):
result = {}
try:
apple_obj = AppStoreConnectApi(self.issuer_id, self.private_key_id, self.p8key)
cert_obj = apple_obj.get_certificate_by_cid(cert_id)
if cert_obj and cert_obj.id:
return True, result
else:
logger.info("ios developer get cert %s failed" % cert_id)
return False, result
except Exception as e:
logger.error("ios developer get cert %s Failed Exception:%s" % (cert_id, e))
result['return_info'] = "%s" % e
return False, result
def revoke_cert(self, cert_id):
result = {}
try:

@ -737,6 +737,17 @@ class IosUtils(object):
certid=None, cert_expire_time=None)
return status, result
@staticmethod
def check_developer_cert(developer_obj,user_obj):
auth = get_auth_form_developer(developer_obj)
app_api_obj = get_api_obj(auth)
status, result = app_api_obj.get_cert_obj_by_cid(developer_obj.certid)
if not status:
AppIOSDeveloperInfo.objects.filter(user_id=user_obj, issuer_id=auth.get("issuer_id")).update(
certid=None, cert_expire_time=None)
return status, result
@staticmethod
def auto_get_certid_by_p12(developer_obj, user_obj):
auth = get_auth_form_developer(developer_obj)

@ -67,11 +67,13 @@ class DeveloperView(APIView):
if act:
res = BaseResponse()
logger.info("user %s iosdeveloper %s act %s" % (request.user, developer_obj, act))
if act == "preactive":
if act == "checkauth":
status, result = IosUtils.active_developer(developer_obj)
if status:
if not developer_obj.certid:
IosUtils.get_device_from_developer(developer_obj, request.user)
else:
IosUtils.check_developer_cert(developer_obj, request.user)
return self.get(request)
else:
res.code = 1008
@ -111,14 +113,6 @@ class DeveloperView(APIView):
res.code = 1008
res.msg = result.get("err_info")
return Response(res.dict)
elif act == "checkauth":
status, result = IosUtils.active_developer(developer_obj)
if status:
return self.get(request)
else:
res.code = 1008
res.msg = result.get("return_info")
return Response(res.dict)
else:
logger.info("user %s iosdeveloper %s update input data %s" % (request.user, developer_obj, data))
logger.info("user %s iosdeveloper %s update old data %s" % (

Loading…
Cancel
Save