Skip to content

Commit

Permalink
fix(API): don't allow running tasks to be deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed Mar 14, 2018
1 parent f8b7dea commit 9dd0d69
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ class TaskController {
@PreAuthorize("hasPermission(this.getOrchestration(#id)?.application, 'APPLICATION', 'WRITE')")
@RequestMapping(value = "/tasks/{id}", method = RequestMethod.DELETE)
void deleteTask(@PathVariable String id) {
executionRepository.delete(ORCHESTRATION, id)
executionRepository.retrieve(ORCHESTRATION, id).with {
if (it.status.complete) {
executionRepository.delete(ORCHESTRATION, id)
} else {
log.warn("Not deleting $ORCHESTRATION $id as it is $it.status")
throw new CannotDeleteRunningExecution(ORCHESTRATION, id)
}
}
}

@PreAuthorize("hasPermission(this.getOrchestration(#id)?.application, 'APPLICATION', 'WRITE')")
Expand Down

0 comments on commit 9dd0d69

Please sign in to comment.