diff --git a/apps/account/views.py b/apps/account/views.py index 06181d52..48848081 100644 --- a/apps/account/views.py +++ b/apps/account/views.py @@ -113,7 +113,8 @@ def post(self, request, *args, **kwargs): app_name = request_data_dict.get('app_name', '') ticket_sn_prefix = request_data_dict.get('ticket_sn_prefix', '') workflow_ids = request_data_dict.get('workflow_ids', '') - username = request.user.username + # username = request.user.username + username = request.META.get('HTTP_USERNAME') flag, msg = AccountBaseService().add_token_record(app_name, ticket_sn_prefix, workflow_ids, username) if flag is False: code, data = -1, {} diff --git a/apps/ticket/views.py b/apps/ticket/views.py index 64764e1f..c6e7796d 100644 --- a/apps/ticket/views.py +++ b/apps/ticket/views.py @@ -17,7 +17,8 @@ def get(self, request, *args, **kwargs): request_data = request.GET sn = request_data.get('sn', '') title = request_data.get('title', '') - username = request_data.get('username', '') + # username = request_data.get('username', '') + username = request.META.get('HTTP_USERNAME') create_start = request_data.get('create_start', '') create_end = request_data.get('create_end', '') workflow_ids = request_data.get('workflow_ids', '') @@ -88,7 +89,8 @@ def get(self, request, *args, **kwargs): if not app_permission_check: return api_response(-1, msg, '') - username = request_data.get('username', '') + # username = request_data.get('username', '') + username = request.META.get('HTTP_USERNAME') if not username: return api_response(-1, '参数不全,请提供username', '') result, msg = TicketBaseService.get_ticket_detail(ticket_id, username) @@ -133,7 +135,8 @@ class TicketTransition(View): def get(self, request, *args, **kwargs): request_data = request.GET ticket_id = kwargs.get('ticket_id') - username = request_data.get('username', '') + # username = request_data.get('username', '') + username = request.META.get('HTTP_USERNAME') from service.account.account_base_service import AccountBaseService app_name = request.META.get('HTTP_APPNAME') app_permission_check, msg = AccountBaseService.app_ticket_permission_check(app_name, ticket_id) @@ -157,7 +160,8 @@ class TicketFlowlog(View): def get(self, request, *args, **kwargs): request_data = request.GET ticket_id = kwargs.get('ticket_id') - username = request_data.get('username', '') # 可用于权限控制 + # username = request_data.get('username', '') # 可用于权限控制 + username = request.META.get('HTTP_USERNAME') per_page = int(request_data.get('per_page', 10)) page = int(request_data.get('page', 1)) from service.account.account_base_service import AccountBaseService @@ -186,7 +190,8 @@ class TicketFlowStep(View): def get(self, request, *args, **kwargs): request_data = request.GET ticket_id = kwargs.get('ticket_id') - username = request_data.get('username', '') # 可用于权限控制 + # username = request_data.get('username', '') # 可用于权限控制 + username = request.META.get('HTTP_USERNAME') from service.account.account_base_service import AccountBaseService app_name = request.META.get('HTTP_APPNAME') @@ -255,7 +260,8 @@ def get(self, request, *args, **kwargs): :return: """ request_data = request.GET - username = request_data.get('username', '') # 可用于权限控制 + # username = request_data.get('username', '') # 可用于权限控制 + username = request.META.get('HTTP_USERNAME') ticket_ids = request_data.get('ticket_ids') # 逗号隔开 ticket_id_list = ticket_ids.split(',') ticket_id_list = [int(ticket_id) for ticket_id in ticket_id_list] diff --git a/apps/workflow/views.py b/apps/workflow/views.py index a722f37a..2184d83e 100644 --- a/apps/workflow/views.py +++ b/apps/workflow/views.py @@ -23,7 +23,8 @@ def get(self, request, *args, **kwargs): name = request_data.get('name', '') per_page = int(request_data.get('per_page', 10)) page = int(request_data.get('page', 1)) - username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + # username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + username = request.META.get('HTTP_USERNAME') app_name = request.META.get('HTTP_APPNAME') from service.account.account_base_service import AccountBaseService @@ -79,7 +80,8 @@ def get(self, request, *args, **kwargs): """ workflow_id = kwargs.get('workflow_id') request_data = request.GET - username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + # username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + username = request.META.get('HTTP_USERNAME') app_name = request.META.get('HTTP_APPNAME') from service.account.account_base_service import AccountBaseService @@ -313,7 +315,8 @@ def get(self, request, *args, **kwargs): """ state_id = kwargs.get('state_id') request_data = request.GET - username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + # username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + username = request.META.get('HTTP_USERNAME') if not username: return api_response(-1, '请提供username', '') @@ -336,7 +339,8 @@ def get(self, request, *args, **kwargs): """ workflow_id = kwargs.get('workflow_id') request_data = request.GET - username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + # username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + username = request.META.get('HTTP_USERNAME') search_value = request_data.get('search_value', '') per_page = int(request_data.get('per_page', 10)) if request_data.get('per_page', 10) else 10 page = int(request_data.get('page', 1)) if request_data.get('page', 1) else 1 @@ -457,7 +461,8 @@ def get(self, request, *args, **kwargs): :return: """ request_data = request.GET - username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + # username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + username = request.META.get('HTTP_USERNAME') if not username: username = request.user.username search_value = request_data.get('search_value', '') @@ -563,7 +568,8 @@ def get(self, request, *args, **kwargs): :return: """ request_data = request.GET - username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + # username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + username = request.META.get('HTTP_USERNAME') if not username: username = request.user.username search_value = request_data.get('search_value', '') @@ -672,7 +678,8 @@ def get(self, request, *args, **kwargs): :return: """ request_data = request.GET - username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + # username = request_data.get('username', '') # 后续会根据username做必要的权限控制 + username = request.META.get('HTTP_USERNAME') if not username: username = request.user.username search_value = request_data.get('search_value', '')