15c08f70 by 冯轩

MOD:权限判断条件

1 parent a90d7e16
No preview for this file type
...@@ -1070,13 +1070,14 @@ class DocView(DocGenericView, DocHandler): ...@@ -1070,13 +1070,14 @@ class DocView(DocGenericView, DocHandler):
1070 token = request.META.get("HTTP_AUTHORIZATION") 1070 token = request.META.get("HTTP_AUTHORIZATION")
1071 user_role = rh.get_token(token[-11:]) 1071 user_role = rh.get_token(token[-11:])
1072 self.running_log.info('[api doc] [user_role={0} business_type={1}] '.format(user_role, business_type)) 1072 self.running_log.info('[api doc] [user_role={0} business_type={1}] '.format(user_role, business_type))
1073 if user_role or user_role == '-1' or (user_role == '1' and business_type == 'HIL') or (user_role == '2' and business_type == 'AFC'): 1073 if user_role is None or user_role == '-1' or (user_role == '1' and business_type == 'HIL') or (user_role == '2' and business_type == 'AFC'):
1074 pagination = {'current': page, 'total': 0, 'page_size': page_size} 1074 # pagination = {'current': page, 'total': 0, 'page_size': page_size}
1075 res = { 1075 # res = {
1076 'pagination': pagination, 1076 # 'pagination': pagination,
1077 'doc_list': [] 1077 # 'doc_list': []
1078 } 1078 # }
1079 return response.ok(data=res) 1079 # return response.ok(data=res)
1080 raise NoPermissionException('no permission')
1080 1081
1081 status_query = Q(status=status) if status is not None else Q() 1082 status_query = Q(status=status) if status is not None else Q()
1082 application_id_query = Q(application_id__contains=application_id) if application_id is not None else Q() 1083 application_id_query = Q(application_id__contains=application_id) if application_id is not None else Q()
...@@ -1248,7 +1249,7 @@ class CompareResultView(GenericView): ...@@ -1248,7 +1249,7 @@ class CompareResultView(GenericView):
1248 token = request.META.get("HTTP_AUTHORIZATION") 1249 token = request.META.get("HTTP_AUTHORIZATION")
1249 user_role = rh.get_token(token[-11:]) 1250 user_role = rh.get_token(token[-11:])
1250 self.running_log.info('[CompareResultView] [user_role={0}] '.format(user_role)) 1251 self.running_log.info('[CompareResultView] [user_role={0}] '.format(user_role))
1251 if user_role or user_role == '-1' or (user_role == '1' and entity == 'HIL') or (user_role == '2' and entity == 'AFC'): 1252 if user_role is None or user_role == '-1' or (user_role == '1' and entity == 'HIL') or (user_role == '2' and entity == 'AFC'):
1252 raise NoPermissionException('no permission') 1253 raise NoPermissionException('no permission')
1253 1254
1254 if is_auto == 1: 1255 if is_auto == 1:
...@@ -1645,13 +1646,14 @@ class AutoSettlementView(GenericView): ...@@ -1645,13 +1646,14 @@ class AutoSettlementView(GenericView):
1645 token = request.META.get("HTTP_AUTHORIZATION") 1646 token = request.META.get("HTTP_AUTHORIZATION")
1646 user_role = rh.get_token(token[-11:]) 1647 user_role = rh.get_token(token[-11:])
1647 self.running_log.info('[AutoSettlementView] [user_role={0}] '.format(user_role)) 1648 self.running_log.info('[AutoSettlementView] [user_role={0}] '.format(user_role))
1648 if user_role or user_role == '-1' or (user_role == '1' and business_type == 'HIL') or (user_role == '2' and business_type == 'AFC'): 1649 if user_role is None or user_role == '-1' or (user_role == '1' and business_type == 'HIL') or (user_role == '2' and business_type == 'AFC'):
1649 pagination = {'current': page, 'total': 0, 'page_size': page_size} 1650 # pagination = {'current': page, 'total': 0, 'page_size': page_size}
1650 res = { 1651 # res = {
1651 'pagination': pagination, 1652 # 'pagination': pagination,
1652 'doc_list': [] 1653 # 'doc_list': []
1653 } 1654 # }
1654 return response.ok(data=res) 1655 # return response.ok(data=res)
1656 raise NoPermissionException('no permission')
1655 1657
1656 if isinstance(auto_result, int): 1658 if isinstance(auto_result, int):
1657 auto_result = consts.RESULT_MAP.get(auto_result) 1659 auto_result = consts.RESULT_MAP.get(auto_result)
...@@ -1741,7 +1743,7 @@ class AutoSettlementExcelView(GenericView): ...@@ -1741,7 +1743,7 @@ class AutoSettlementExcelView(GenericView):
1741 token = request.META.get("HTTP_AUTHORIZATION") 1743 token = request.META.get("HTTP_AUTHORIZATION")
1742 user_role = rh.get_token(token[-11:]) 1744 user_role = rh.get_token(token[-11:])
1743 self.running_log.info('[AutoSettlementExcelView] [user_role={0}] '.format(user_role)) 1745 self.running_log.info('[AutoSettlementExcelView] [user_role={0}] '.format(user_role))
1744 if user_role or user_role == '-1' or (user_role == '1' and business_type == 'HIL') or (user_role == '2' and business_type == 'AFC'): 1746 if user_role is None or user_role == '-1' or (user_role == '1' and business_type == 'HIL') or (user_role == '2' and business_type == 'AFC'):
1745 raise NoPermissionException('no permission') 1747 raise NoPermissionException('no permission')
1746 1748
1747 if isinstance(auto_result, int): 1749 if isinstance(auto_result, int):
...@@ -1906,7 +1908,7 @@ class InvoiceExcelView(GenericView): ...@@ -1906,7 +1908,7 @@ class InvoiceExcelView(GenericView):
1906 token = request.META.get("HTTP_AUTHORIZATION") 1908 token = request.META.get("HTTP_AUTHORIZATION")
1907 user_role = rh.get_token(token[-11:]) 1909 user_role = rh.get_token(token[-11:])
1908 self.running_log.info('[InvoiceExcelView] [user_role={0}] '.format(user_role)) 1910 self.running_log.info('[InvoiceExcelView] [user_role={0}] '.format(user_role))
1909 if user_role or user_role == '-1' or (user_role == '1' and application_entity == 'HIL') or (user_role == '2' and application_entity == 'AFC'): 1911 if user_role is None or user_role == '-1' or (user_role == '1' and application_entity == 'HIL') or (user_role == '2' and application_entity == 'AFC'):
1910 raise NoPermissionException('no permission') 1912 raise NoPermissionException('no permission')
1911 1913
1912 url = 'http://127.0.0.1:8088/napi/invoice/downloadExcelOri' 1914 url = 'http://127.0.0.1:8088/napi/invoice/downloadExcelOri'
...@@ -1950,7 +1952,7 @@ class InvoiceQueryInfoView(GenericView): ...@@ -1950,7 +1952,7 @@ class InvoiceQueryInfoView(GenericView):
1950 token = request.META.get("HTTP_AUTHORIZATION") 1952 token = request.META.get("HTTP_AUTHORIZATION")
1951 user_role = rh.get_token(token[-11:]) 1953 user_role = rh.get_token(token[-11:])
1952 self.running_log.info('[InvoiceQueryInfoView] [user_role={0}] '.format(user_role)) 1954 self.running_log.info('[InvoiceQueryInfoView] [user_role={0}] '.format(user_role))
1953 if user_role or user_role == '-1' or (user_role == '1' and application_entity == 'HIL') or (user_role == '2' and application_entity == 'AFC'): 1955 if user_role is None or user_role == '-1' or (user_role == '1' and application_entity == 'HIL') or (user_role == '2' and application_entity == 'AFC'):
1954 raise NoPermissionException('no permission') 1956 raise NoPermissionException('no permission')
1955 1957
1956 url = 'http://127.0.0.1:8088/napi/invoice/queryInfoOri' 1958 url = 'http://127.0.0.1:8088/napi/invoice/queryInfoOri'
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!