mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 20:58:28 +00:00
Fixes SonarCloud issue L23. Verifies that study ids match.
This commit is contained in:
parent
0cc98616fd
commit
6af1693bdc
@ -28,6 +28,11 @@ class CompleteTemplate(Script):
|
|||||||
"the name of the docx template to use.")
|
"the name of the docx template to use.")
|
||||||
file_name = args[0]
|
file_name = args[0]
|
||||||
workflow_spec_model = self.find_spec_model_in_db(task.workflow)
|
workflow_spec_model = self.find_spec_model_in_db(task.workflow)
|
||||||
|
task_study_id = task.workflow.data[WorkflowProcessor.STUDY_ID_KEY]
|
||||||
|
|
||||||
|
if task_study_id != study_id:
|
||||||
|
raise ApiError(code="invalid_argument",
|
||||||
|
message="The given task does not match the given study.")
|
||||||
|
|
||||||
if workflow_spec_model is None:
|
if workflow_spec_model is None:
|
||||||
raise ApiError(code="workflow_model_error",
|
raise ApiError(code="workflow_model_error",
|
||||||
@ -44,7 +49,6 @@ class CompleteTemplate(Script):
|
|||||||
"within workflow specification '%s'") % (args[0], workflow_spec_model.id)
|
"within workflow specification '%s'") % (args[0], workflow_spec_model.id)
|
||||||
|
|
||||||
final_document_stream = self.make_template(BytesIO(file_data_model.data), task.data)
|
final_document_stream = self.make_template(BytesIO(file_data_model.data), task.data)
|
||||||
study_id = task.workflow.data[WorkflowProcessor.STUDY_ID_KEY]
|
|
||||||
workflow_id = task.workflow.data[WorkflowProcessor.WORKFLOW_ID_KEY]
|
workflow_id = task.workflow.data[WorkflowProcessor.WORKFLOW_ID_KEY]
|
||||||
FileService.add_task_file(study_id=study_id, workflow_id=workflow_id, task_id=task.id,
|
FileService.add_task_file(study_id=study_id, workflow_id=workflow_id, task_id=task.id,
|
||||||
name=file_name,
|
name=file_name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user