c64af440 by 冯轩

MOD:

1 parent 4fb6a0f2
...@@ -55,6 +55,7 @@ class LoginView(ObtainJSONWebToken, GenericView): ...@@ -55,6 +55,7 @@ class LoginView(ObtainJSONWebToken, GenericView):
55 'role': user_role.role if user_role else -1 55 'role': user_role.role if user_role else -1
56 } 56 }
57 rh.set_token(res.data.get('token')[-10:], user.username) 57 rh.set_token(res.data.get('token')[-10:], user.username)
58 rh.set_token(res.data.get('token')[-11:], user_role.role if user_role else -1)
58 return response.ok(data=data) 59 return response.ok(data=data)
59 60
60 61
...@@ -85,9 +86,10 @@ class IWALoginView(IWABaseView, GenericView): ...@@ -85,9 +86,10 @@ class IWALoginView(IWABaseView, GenericView):
85 is_valid, data = self.validate(q_number) 86 is_valid, data = self.validate(q_number)
86 87
87 if is_valid: 88 if is_valid:
88 rh.set_token(data.get('token')[-10:], data.get('user_name'))
89 user_role = UserRole.objects.filter(auth_user_id=data.get('user_id')).first() 89 user_role = UserRole.objects.filter(auth_user_id=data.get('user_id')).first()
90 data['role'] = user_role.role if user_role else -1 90 data['role'] = user_role.role if user_role else -1
91 rh.set_token(data.get('token')[-10:], data.get('user_name'))
92 rh.set_token(data.get('token')[-11:], user_role.role if user_role else -1)
91 return response.ok(data=data) 93 return response.ok(data=data)
92 else: 94 else:
93 self.no_permission(data) 95 self.no_permission(data)
......
...@@ -1065,6 +1065,9 @@ class DocView(DocGenericView, DocHandler): ...@@ -1065,6 +1065,9 @@ class DocView(DocGenericView, DocHandler):
1065 create_time_start = args.get('create_time_start') 1065 create_time_start = args.get('create_time_start')
1066 create_time_end = args.get('create_time_end') 1066 create_time_end = args.get('create_time_end')
1067 1067
1068 token = request.META.get("HTTP_AUTHORIZATION")
1069 user_role = rh.get_token(token[-11:])
1070
1068 status_query = Q(status=status) if status is not None else Q() 1071 status_query = Q(status=status) if status is not None else Q()
1069 application_id_query = Q(application_id__contains=application_id) if application_id is not None else Q() 1072 application_id_query = Q(application_id__contains=application_id) if application_id is not None else Q()
1070 data_source_query = Q(data_source=data_source) if data_source is not None else Q() 1073 data_source_query = Q(data_source=data_source) if data_source is not None else Q()
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!