Merge branch 'dev' into STG-181_frontend-ux-model-changes

This commit is contained in:
Kelly McDonald 2021-02-17 07:49:05 -05:00
commit 93f29e86d8
2 changed files with 10 additions and 3 deletions

View File

@ -22,10 +22,12 @@ from crc import session, app
from crc.api.common import ApiError from crc.api.common import ApiError
from crc.models.file import FileDataModel, FileModel, FileType from crc.models.file import FileDataModel, FileModel, FileType
from crc.models.task_event import TaskEventModel from crc.models.task_event import TaskEventModel
from crc.models.user import UserModelSchema
from crc.models.workflow import WorkflowStatus, WorkflowModel, WorkflowSpecDependencyFile from crc.models.workflow import WorkflowStatus, WorkflowModel, WorkflowSpecDependencyFile
from crc.scripts.script import Script from crc.scripts.script import Script
from crc.services.file_service import FileService from crc.services.file_service import FileService
from crc import app from crc import app
from crc.services.user_service import UserService
class CustomBpmnScriptEngine(BpmnScriptEngine): class CustomBpmnScriptEngine(BpmnScriptEngine):
@ -167,10 +169,18 @@ class WorkflowProcessor(object):
spec = None spec = None
self.workflow_spec_id = workflow_model.workflow_spec_id self.workflow_spec_id = workflow_model.workflow_spec_id
try: try:
self.bpmn_workflow = self.__get_bpmn_workflow(workflow_model, spec, validate_only) self.bpmn_workflow = self.__get_bpmn_workflow(workflow_model, spec, validate_only)
self.bpmn_workflow.script_engine = self._script_engine self.bpmn_workflow.script_engine = self._script_engine
if UserService.has_user():
current_user = UserService.current_user(allow_admin_impersonate=True)
current_user_data = UserModelSchema().dump(current_user)
tasks = self.bpmn_workflow.get_tasks(SpiffTask.READY)
for task in tasks:
task.data['current_user'] = current_user_data
if self.WORKFLOW_ID_KEY not in self.bpmn_workflow.data: if self.WORKFLOW_ID_KEY not in self.bpmn_workflow.data:
if not workflow_model.id: if not workflow_model.id:
session.add(workflow_model) session.add(workflow_model)

View File

@ -512,9 +512,6 @@ class WorkflowService(object):
# not be a previously completed MI Task. # not be a previously completed MI Task.
if add_docs_and_forms: if add_docs_and_forms:
task.data = spiff_task.data task.data = spiff_task.data
if UserService.has_user():
current_user = UserService.current_user(allow_admin_impersonate=True)
task.data['current_user'] = UserModelSchema().dump(current_user)
if hasattr(spiff_task.task_spec, "form"): if hasattr(spiff_task.task_spec, "form"):
task.form = spiff_task.task_spec.form task.form = spiff_task.task_spec.form
for i, field in enumerate(task.form.fields): for i, field in enumerate(task.form.fields):