remove the "current_user" from being added to the task_data.
This commit is contained in:
parent
7c7e2d6915
commit
23403acd29
|
@ -283,7 +283,7 @@ def task_show(process_instance_id: int, task_id: str) -> flask.wrappers.Response
|
|||
|
||||
_munge_form_ui_schema_based_on_hidden_fields_in_task_data(task)
|
||||
|
||||
if task.properties and task.data and "instructionsForEndUser" in task.properties:
|
||||
if task.properties and "instructionsForEndUser" in task.properties:
|
||||
if task.properties["instructionsForEndUser"]:
|
||||
try:
|
||||
task.properties["instructionsForEndUser"] = _render_jinja_template(
|
||||
|
|
|
@ -174,7 +174,7 @@ class NonTaskDataBasedScriptEngineEnvironment(BasePythonScriptEngineEnvironment)
|
|||
"""NonTaskDataBasedScriptEngineEnvironment."""
|
||||
self.state: Dict[str, Any] = {}
|
||||
self.non_user_defined_keys = set(
|
||||
[*environment_globals.keys()] + ["__builtins__", "current_user"]
|
||||
[*environment_globals.keys()] + ["__builtins__"]
|
||||
)
|
||||
super().__init__(environment_globals)
|
||||
|
||||
|
@ -492,7 +492,6 @@ class ProcessInstanceProcessor:
|
|||
subprocesses=subprocesses,
|
||||
)
|
||||
self.set_script_engine(self.bpmn_process_instance)
|
||||
self.add_user_info_to_process_instance(self.bpmn_process_instance)
|
||||
|
||||
except MissingSpecError as ke:
|
||||
raise ApiError(
|
||||
|
@ -563,17 +562,6 @@ class ProcessInstanceProcessor:
|
|||
|
||||
return current_user
|
||||
|
||||
def add_user_info_to_process_instance(
|
||||
self, bpmn_process_instance: BpmnWorkflow
|
||||
) -> None:
|
||||
"""Add_user_info_to_process_instance."""
|
||||
current_user = self.current_user()
|
||||
|
||||
if current_user:
|
||||
current_user_data = UserModelSchema().dump(current_user)
|
||||
tasks = bpmn_process_instance.get_tasks(TaskState.READY)
|
||||
for task in tasks:
|
||||
task.data["current_user"] = current_user_data
|
||||
|
||||
@staticmethod
|
||||
def get_bpmn_process_instance_from_workflow_spec(
|
||||
|
@ -1569,14 +1557,10 @@ class ProcessInstanceProcessor:
|
|||
except WorkflowTaskException as we:
|
||||
raise ApiError.from_workflow_exception("task_error", str(we), we) from we
|
||||
|
||||
def user_defined_task_data(self, task_data: dict) -> dict:
|
||||
"""UserDefinedTaskData."""
|
||||
return {k: v for k, v in task_data.items() if k != "current_user"}
|
||||
|
||||
def check_task_data_size(self) -> None:
|
||||
"""CheckTaskDataSize."""
|
||||
tasks_to_check = self.bpmn_process_instance.get_tasks(TaskState.FINISHED_MASK)
|
||||
task_data = [self.user_defined_task_data(task.data) for task in tasks_to_check]
|
||||
task_data = [task.data for task in tasks_to_check]
|
||||
task_data_to_check = list(filter(len, task_data))
|
||||
|
||||
try:
|
||||
|
|
|
@ -174,11 +174,7 @@ class ProcessInstanceService:
|
|||
not hasattr(spiff_task.task_spec, "lane")
|
||||
or spiff_task.task_spec.lane is None
|
||||
):
|
||||
current_user = spiff_task.data["current_user"]
|
||||
return [
|
||||
current_user["id"],
|
||||
]
|
||||
# return [processor.process_instance_model.process_initiator_id]
|
||||
return [processor.process_instance_model.process_initiator_id]
|
||||
|
||||
if spiff_task.task_spec.lane not in spiff_task.data:
|
||||
return [] # No users are assignable to the task at this moment
|
||||
|
|
|
@ -1225,10 +1225,6 @@ class TestProcessApi(BaseTest):
|
|||
assert response.json["updated_at_in_seconds"] > 0
|
||||
assert response.json["status"] == "complete"
|
||||
assert response.json["process_model_identifier"] == process_model_identifier
|
||||
assert (
|
||||
response.json["data"]["current_user"]["username"]
|
||||
== with_super_admin_user.username
|
||||
)
|
||||
assert response.json["data"]["Mike"] == "Awesome"
|
||||
assert response.json["data"]["person"] == "Kevin"
|
||||
|
||||
|
@ -2232,10 +2228,10 @@ class TestProcessApi(BaseTest):
|
|||
assert process_instance.status == "error"
|
||||
processor = ProcessInstanceProcessor(process_instance)
|
||||
spiff_task = processor.get_task_by_bpmn_identifier(
|
||||
"script_task_one", processor.bpmn_process_instance
|
||||
"script_task_two", processor.bpmn_process_instance
|
||||
)
|
||||
assert spiff_task is not None
|
||||
assert spiff_task.data != {}
|
||||
assert spiff_task.data == {'my_var': 'THE VAR'}
|
||||
|
||||
def test_process_model_file_create(
|
||||
self,
|
||||
|
|
Loading…
Reference in New Issue