Skip to content

Commit

Permalink
bugfix: username arg logic missing
Browse files Browse the repository at this point in the history
  • Loading branch information
blackholll committed May 6, 2019
1 parent e472288 commit 752bf46
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions apps/ticket/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def post(self, request, *args, **kwargs):
return api_response(-1, 'post参数为空', {})
request_data_dict = json.loads(json_str)
app_name = request.META.get('HTTP_APPNAME')
request_data_dict.update(dict(username=request.META.get('HTTP_USERNAME')))

from service.account.account_base_service import AccountBaseService
# 判断是否有创建某工单的权限
Expand Down Expand Up @@ -116,6 +117,7 @@ def patch(self, request, *args, **kwargs):

from service.account.account_base_service import AccountBaseService
app_name = request.META.get('HTTP_APPNAME')
request_data_dict.update(dict(username=request.META.get('HTTP_USERNAME')))
app_permission_check, msg = AccountBaseService.app_ticket_permission_check(app_name, ticket_id)
if not app_permission_check:
return api_response(-1, msg, '')
Expand Down Expand Up @@ -228,7 +230,8 @@ def put(self, request, *args, **kwargs):
return api_response(-1, 'patch参数为空', {})
request_data_dict = json.loads(json_str)
ticket_id = kwargs.get('ticket_id')
username = request_data_dict.get('username', '') # 可用于权限控制
# username = request_data_dict.get('username', '') # 可用于权限控制
username = request.META.get('HTTP_USERNAME')
state_id = request_data_dict.get('state_id')

from service.account.account_base_service import AccountBaseService
Expand Down Expand Up @@ -288,7 +291,8 @@ def post(self, request, *args, **kwargs):
return api_response(-1, 'post参数为空', {})
request_data_dict = json.loads(json_str)
ticket_id = kwargs.get('ticket_id')
username = request_data_dict.get('username', '')
# username = request_data_dict.get('username', '')
username = request.META.get('HTTP_USERNAME')

from service.account.account_base_service import AccountBaseService
app_name = request.META.get('HTTP_APPNAME')
Expand Down Expand Up @@ -319,7 +323,8 @@ def post(self, request, *args, **kwargs):
return api_response(-1, 'post参数为空', {})
request_data_dict = json.loads(json_str)
ticket_id = kwargs.get('ticket_id')
username = request_data_dict.get('username', '')
# username = request_data_dict.get('username', '')
username = request.META.get('HTTP_USERNAME')
target_username = request_data_dict.get('target_username', '')
suggestion = request_data_dict.get('suggestion', '')

Expand Down Expand Up @@ -351,7 +356,8 @@ def post(self, request, *args, **kwargs):
return api_response(-1, 'post参数为空', {})
request_data_dict = json.loads(json_str)
ticket_id = kwargs.get('ticket_id')
username = request_data_dict.get('username', '')
# username = request_data_dict.get('username', '')
username = request.META.get('HTTP_USERNAME')
target_username = request_data_dict.get('target_username', '')
suggestion = request_data_dict.get('suggestion', '')

Expand Down Expand Up @@ -383,7 +389,8 @@ def post(self, request, *args, **kwargs):
return api_response(-1, 'post参数为空', {})
request_data_dict = json.loads(json_str)
ticket_id = kwargs.get('ticket_id')
username = request_data_dict.get('username', '')
# username = request_data_dict.get('username', '')
username = request.META.get('HTTP_USERNAME')
suggestion = request_data_dict.get('suggestion', '')

from service.account.account_base_service import AccountBaseService
Expand Down Expand Up @@ -414,7 +421,8 @@ def patch(self, request, *args, **kwargs):
return api_response(-1, 'post参数为空', {})
request_data_dict = json.loads(json_str)
ticket_id = kwargs.get('ticket_id')
username = request_data_dict.get('username', '')
# username = request_data_dict.get('username', '')
username = request.META.get('HTTP_USERNAME')

from service.account.account_base_service import AccountBaseService
app_name = request.META.get('HTTP_APPNAME')
Expand All @@ -441,7 +449,8 @@ def post(self, request, *args, **kwargs):
return api_response(-1, 'post参数为空', {})
request_data_dict = json.loads(json_str)
ticket_id = kwargs.get('ticket_id')
username = request_data_dict.get('username', '')
# username = request_data_dict.get('username', '')
username = request.META.get('HTTP_USERNAME')

from service.account.account_base_service import AccountBaseService
app_name = request.META.get('HTTP_APPNAME')
Expand Down Expand Up @@ -473,7 +482,8 @@ def post(self, request, *args, **kwargs):
return api_response(-1, 'post参数为空', {})
request_data_dict = json.loads(json_str)
ticket_id = kwargs.get('ticket_id')
username = request_data_dict.get('username', '')
# username = request_data_dict.get('username', '')
username = request.META.get('HTTP_USERNAME')
suggestion = request_data_dict.get('suggestion', '')
result, msg = TicketBaseService.add_comment(ticket_id, username, suggestion)
if result:
Expand Down

0 comments on commit 752bf46

Please sign in to comment.