mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 13:18:35 +00:00
Remove current_user
from task data
This commit is contained in:
parent
1d8fc77cf3
commit
f74afc3e18
@ -140,15 +140,12 @@ class WorkflowProcessor(object):
|
||||
check_sub_specs(my_spec['spec'], indent + 5)
|
||||
check_sub_specs(test_spec, 5)
|
||||
|
||||
|
||||
self.workflow_spec_id = workflow_model.workflow_spec_id
|
||||
|
||||
try:
|
||||
self.bpmn_workflow = self.__get_bpmn_workflow(workflow_model, spec, validate_only)
|
||||
self.bpmn_workflow.script_engine = self._script_engine
|
||||
|
||||
self.add_user_info_to_workflow(self.bpmn_workflow)
|
||||
|
||||
if self.WORKFLOW_ID_KEY not in self.bpmn_workflow.data:
|
||||
if not workflow_model.id:
|
||||
session.add(workflow_model)
|
||||
@ -167,18 +164,6 @@ class WorkflowProcessor(object):
|
||||
" '%s' due to a mis-placed or missing task '%s'" %
|
||||
(self.workflow_spec_id, str(ke)))
|
||||
|
||||
@staticmethod
|
||||
def add_user_info_to_workflow(bpmn_workflow):
|
||||
if UserService.has_user():
|
||||
current_user = UserService.current_user(allow_admin_impersonate=True)
|
||||
if UserService.user_is_admin() and UserService.admin_is_impersonating():
|
||||
impersonator = UserService.get_impersonator()
|
||||
current_user.impersonator = impersonator
|
||||
current_user_data = UserModelSchema().dump(current_user)
|
||||
tasks = bpmn_workflow.get_tasks(TaskState.READY)
|
||||
for task in tasks:
|
||||
task.data['current_user'] = current_user_data
|
||||
|
||||
@staticmethod
|
||||
def reset(workflow_model, clear_data=False):
|
||||
"""Resets the workflow back to an unstarted state - where nothing has
|
||||
@ -259,7 +244,6 @@ class WorkflowProcessor(object):
|
||||
bpmn_workflow = BpmnWorkflow(spec, script_engine=WorkflowProcessor._script_engine)
|
||||
bpmn_workflow.data[WorkflowProcessor.STUDY_ID_KEY] = study.id
|
||||
bpmn_workflow.data[WorkflowProcessor.VALIDATION_PROCESS_KEY] = False
|
||||
WorkflowProcessor.add_user_info_to_workflow(bpmn_workflow)
|
||||
bpmn_workflow.do_engine_steps()
|
||||
except WorkflowException as we:
|
||||
raise ApiError.from_task_spec("error_running_master_spec", str(we), we.sender)
|
||||
|
Loading…
x
Reference in New Issue
Block a user