c64af440 by 冯轩

MOD:

1 parent 4fb6a0f2
......@@ -55,6 +55,7 @@ class LoginView(ObtainJSONWebToken, GenericView):
'role': user_role.role if user_role else -1
}
rh.set_token(res.data.get('token')[-10:], user.username)
rh.set_token(res.data.get('token')[-11:], user_role.role if user_role else -1)
return response.ok(data=data)
......@@ -85,9 +86,10 @@ class IWALoginView(IWABaseView, GenericView):
is_valid, data = self.validate(q_number)
if is_valid:
rh.set_token(data.get('token')[-10:], data.get('user_name'))
user_role = UserRole.objects.filter(auth_user_id=data.get('user_id')).first()
data['role'] = user_role.role if user_role else -1
rh.set_token(data.get('token')[-10:], data.get('user_name'))
rh.set_token(data.get('token')[-11:], user_role.role if user_role else -1)
return response.ok(data=data)
else:
self.no_permission(data)
......
......@@ -1065,6 +1065,9 @@ class DocView(DocGenericView, DocHandler):
create_time_start = args.get('create_time_start')
create_time_end = args.get('create_time_end')
token = request.META.get("HTTP_AUTHORIZATION")
user_role = rh.get_token(token[-11:])
status_query = Q(status=status) if status is not None else Q()
application_id_query = Q(application_id__contains=application_id) if application_id is not None else Q()
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!