def get(self, request, *args, **kwargs): """ 获取工作流初始状态信息,包括状态详情以及允许的transition :param request: :param args: :param kwargs: :return: """ workflow_id = kwargs.get('workflow_id') request_data = request.GET # 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 # 判断是否有工作流的权限 app_permission, msg = AccountBaseService.app_workflow_permission_check( app_name, workflow_id) if not app_permission: return api_response( -1, 'APP:{} have no permission to get this workflow info'.format( app_name), '') if not (workflow_id and username): return api_response(-1, '请提供username', '') state_result, msg = WorkflowStateService.get_workflow_init_state( workflow_id) if state_result is not False: code, msg, data = 0, '', state_result else: code, msg, data = -1, msg, '' return api_response(code, msg, data)
def get(self, request, *args, **kwargs): """ 获取工作流初始状态信息,包括状态详情以及允许的transition :param request: :param args: :param kwargs: :return: """ workflow_id = kwargs.get('workflow_id') request_data = request.GET username = request_data.get('username', '') # 后续会根据username做必要的权限控制 if not (workflow_id and username): return api_response(-1, '请提供workflow_id和username', '') state_result, msg = WorkflowStateService.get_workflow_init_state(workflow_id) if state_result is not False: code, msg, data = 0, '', state_result else: code, msg, data = -1, msg, '' return api_response(code, msg, data)