merge:权限判断条件
Showing
1 changed file
with
20 additions
and
19 deletions
| ... | @@ -1076,14 +1076,14 @@ class DocView(DocGenericView, DocHandler): | ... | @@ -1076,14 +1076,14 @@ class DocView(DocGenericView, DocHandler): |
| 1076 | token = request.META.get("HTTP_AUTHORIZATION") | 1076 | token = request.META.get("HTTP_AUTHORIZATION") |
| 1077 | user_role = rh.get_token(token[-11:]) | 1077 | user_role = rh.get_token(token[-11:]) |
| 1078 | self.running_log.info('[api doc] [user_role={0} business_type={1}] '.format(user_role, business_type)) | 1078 | self.running_log.info('[api doc] [user_role={0} business_type={1}] '.format(user_role, business_type)) |
| 1079 | if user_role or user_role == '-1' or (user_role == '1' and business_type == 'HIL') or (user_role == '2' and business_type == 'AFC'): | 1079 | 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'): |
| 1080 | self.running_log.info('[api doc] [no permission]') | 1080 | # pagination = {'current': page, 'total': 0, 'page_size': page_size} |
| 1081 | pagination = {'current': page, 'total': 0, 'page_size': page_size} | 1081 | # res = { |
| 1082 | res = { | 1082 | # 'pagination': pagination, |
| 1083 | 'pagination': pagination, | 1083 | # 'doc_list': [] |
| 1084 | 'doc_list': [] | 1084 | # } |
| 1085 | } | 1085 | # return response.ok(data=res) |
| 1086 | return response.ok(data=res) | 1086 | raise NoPermissionException('no permission') |
| 1087 | 1087 | ||
| 1088 | status_query = Q(status=status) if status is not None else Q() | 1088 | status_query = Q(status=status) if status is not None else Q() |
| 1089 | application_id_query = Q(application_id__contains=application_id) if application_id is not None else Q() | 1089 | application_id_query = Q(application_id__contains=application_id) if application_id is not None else Q() |
| ... | @@ -1255,7 +1255,7 @@ class CompareResultView(GenericView): | ... | @@ -1255,7 +1255,7 @@ class CompareResultView(GenericView): |
| 1255 | token = request.META.get("HTTP_AUTHORIZATION") | 1255 | token = request.META.get("HTTP_AUTHORIZATION") |
| 1256 | user_role = rh.get_token(token[-11:]) | 1256 | user_role = rh.get_token(token[-11:]) |
| 1257 | self.running_log.info('[CompareResultView] [user_role={0}] '.format(user_role)) | 1257 | self.running_log.info('[CompareResultView] [user_role={0}] '.format(user_role)) |
| 1258 | if user_role or user_role == '-1' or (user_role == '1' and entity == 'HIL') or (user_role == '2' and entity == 'AFC'): | 1258 | if user_role is None or user_role == '-1' or (user_role == '1' and entity == 'HIL') or (user_role == '2' and entity == 'AFC'): |
| 1259 | raise NoPermissionException('no permission') | 1259 | raise NoPermissionException('no permission') |
| 1260 | 1260 | ||
| 1261 | if is_auto == 1: | 1261 | if is_auto == 1: |
| ... | @@ -1660,13 +1660,14 @@ class AutoSettlementView(GenericView): | ... | @@ -1660,13 +1660,14 @@ class AutoSettlementView(GenericView): |
| 1660 | token = request.META.get("HTTP_AUTHORIZATION") | 1660 | token = request.META.get("HTTP_AUTHORIZATION") |
| 1661 | user_role = rh.get_token(token[-11:]) | 1661 | user_role = rh.get_token(token[-11:]) |
| 1662 | self.running_log.info('[AutoSettlementView] [user_role={0}] '.format(user_role)) | 1662 | self.running_log.info('[AutoSettlementView] [user_role={0}] '.format(user_role)) |
| 1663 | if user_role or user_role == '-1' or (user_role == '1' and business_type == 'HIL') or (user_role == '2' and business_type == 'AFC'): | 1663 | 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'): |
| 1664 | pagination = {'current': page, 'total': 0, 'page_size': page_size} | 1664 | # pagination = {'current': page, 'total': 0, 'page_size': page_size} |
| 1665 | res = { | 1665 | # res = { |
| 1666 | 'pagination': pagination, | 1666 | # 'pagination': pagination, |
| 1667 | 'doc_list': [] | 1667 | # 'doc_list': [] |
| 1668 | } | 1668 | # } |
| 1669 | return response.ok(data=res) | 1669 | # return response.ok(data=res) |
| 1670 | raise NoPermissionException('no permission') | ||
| 1670 | 1671 | ||
| 1671 | if isinstance(auto_result, int): | 1672 | if isinstance(auto_result, int): |
| 1672 | auto_result = consts.RESULT_MAP.get(auto_result) | 1673 | auto_result = consts.RESULT_MAP.get(auto_result) |
| ... | @@ -1756,7 +1757,7 @@ class AutoSettlementExcelView(GenericView): | ... | @@ -1756,7 +1757,7 @@ class AutoSettlementExcelView(GenericView): |
| 1756 | token = request.META.get("HTTP_AUTHORIZATION") | 1757 | token = request.META.get("HTTP_AUTHORIZATION") |
| 1757 | user_role = rh.get_token(token[-11:]) | 1758 | user_role = rh.get_token(token[-11:]) |
| 1758 | self.running_log.info('[AutoSettlementExcelView] [user_role={0}] '.format(user_role)) | 1759 | self.running_log.info('[AutoSettlementExcelView] [user_role={0}] '.format(user_role)) |
| 1759 | if user_role or user_role == '-1' or (user_role == '1' and business_type == 'HIL') or (user_role == '2' and business_type == 'AFC'): | 1760 | 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'): |
| 1760 | raise NoPermissionException('no permission') | 1761 | raise NoPermissionException('no permission') |
| 1761 | 1762 | ||
| 1762 | if isinstance(auto_result, int): | 1763 | if isinstance(auto_result, int): |
| ... | @@ -1921,7 +1922,7 @@ class InvoiceExcelView(GenericView): | ... | @@ -1921,7 +1922,7 @@ class InvoiceExcelView(GenericView): |
| 1921 | token = request.META.get("HTTP_AUTHORIZATION") | 1922 | token = request.META.get("HTTP_AUTHORIZATION") |
| 1922 | user_role = rh.get_token(token[-11:]) | 1923 | user_role = rh.get_token(token[-11:]) |
| 1923 | self.running_log.info('[InvoiceExcelView] [user_role={0}] '.format(user_role)) | 1924 | self.running_log.info('[InvoiceExcelView] [user_role={0}] '.format(user_role)) |
| 1924 | if user_role or user_role == '-1' or (user_role == '1' and application_entity == 'HIL') or (user_role == '2' and application_entity == 'AFC'): | 1925 | 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'): |
| 1925 | raise NoPermissionException('no permission') | 1926 | raise NoPermissionException('no permission') |
| 1926 | 1927 | ||
| 1927 | url = 'http://127.0.0.1:8088/napi/invoice/downloadExcelOri' | 1928 | url = 'http://127.0.0.1:8088/napi/invoice/downloadExcelOri' |
| ... | @@ -1965,7 +1966,7 @@ class InvoiceQueryInfoView(GenericView): | ... | @@ -1965,7 +1966,7 @@ class InvoiceQueryInfoView(GenericView): |
| 1965 | token = request.META.get("HTTP_AUTHORIZATION") | 1966 | token = request.META.get("HTTP_AUTHORIZATION") |
| 1966 | user_role = rh.get_token(token[-11:]) | 1967 | user_role = rh.get_token(token[-11:]) |
| 1967 | self.running_log.info('[InvoiceQueryInfoView] [user_role={0}] '.format(user_role)) | 1968 | self.running_log.info('[InvoiceQueryInfoView] [user_role={0}] '.format(user_role)) |
| 1968 | if user_role or user_role == '-1' or (user_role == '1' and application_entity == 'HIL') or (user_role == '2' and application_entity == 'AFC'): | 1969 | 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'): |
| 1969 | raise NoPermissionException('no permission') | 1970 | raise NoPermissionException('no permission') |
| 1970 | 1971 | ||
| 1971 | url = 'http://127.0.0.1:8088/napi/invoice/queryInfoOri' | 1972 | url = 'http://127.0.0.1:8088/napi/invoice/queryInfoOri' | ... | ... |
-
Please register or sign in to post a comment