Skip to content

Commit

Permalink
fix(authorization): Use EXECUTE privilege for restarting stages (#3097
Browse files Browse the repository at this point in the history
)
  • Loading branch information
AbdulRahmanAlHamali authored and robzienert committed Aug 26, 2019
1 parent c26e496 commit 9179faf
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ class TaskController {
}
}

@PreAuthorize("hasPermission(this.getOrchestration(#id)?.application, 'APPLICATION', 'WRITE')")
@PreAuthorize("hasPermission(this.getOrchestration(#id)?.application, 'APPLICATION', 'EXECUTE')")
@RequestMapping(value = "/tasks/{id}/cancel", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.ACCEPTED)
void cancelTask(@PathVariable String id) {
cancelExecution(ORCHESTRATION, id)
}

@PreFilter("hasPermission(this.getOrchestration(filterObject)?.application, 'APPLICATION', 'WRITE')")
@PreFilter("hasPermission(this.getOrchestration(filterObject)?.application, 'APPLICATION', 'EXECUTE')")
@RequestMapping(value = "/tasks/cancel", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.ACCEPTED)
void cancelTasks(@RequestBody List<String> taskIds) {
Expand Down Expand Up @@ -412,7 +412,7 @@ class TaskController {
}
}

@PreAuthorize("hasPermission(this.getPipeline(#id)?.application, 'APPLICATION', 'WRITE')")
@PreAuthorize("hasPermission(this.getPipeline(#id)?.application, 'APPLICATION', 'EXECUTE')")
@RequestMapping(value = "/pipelines/{id}/cancel", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.ACCEPTED)
void cancel(
Expand All @@ -421,7 +421,7 @@ class TaskController {
cancelExecution(PIPELINE, id, reason)
}

@PreAuthorize("hasPermission(this.getPipeline(#id)?.application, 'APPLICATION', 'WRITE')")
@PreAuthorize("hasPermission(this.getPipeline(#id)?.application, 'APPLICATION', 'EXECUTE')")
@RequestMapping(value = "/pipelines/{id}/pause", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.ACCEPTED)
void pause(@PathVariable String id) {
Expand All @@ -430,7 +430,7 @@ class TaskController {
executionRunner.reschedule(pipeline)
}

@PreAuthorize("hasPermission(this.getPipeline(#id)?.application, 'APPLICATION', 'WRITE')")
@PreAuthorize("hasPermission(this.getPipeline(#id)?.application, 'APPLICATION', 'EXECUTE')")
@RequestMapping(value = "/pipelines/{id}/resume", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.ACCEPTED)
void resume(@PathVariable String id) {
Expand All @@ -455,7 +455,7 @@ class TaskController {
[]
}

@PreAuthorize("hasPermission(this.getPipeline(#id)?.application, 'APPLICATION', 'WRITE')")
@PreAuthorize("hasPermission(this.getPipeline(#id)?.application, 'APPLICATION', 'EXECUTE')")
@RequestMapping(value = "/pipelines/{id}/stages/{stageId}", method = RequestMethod.PATCH)
Execution updatePipelineStage(
@PathVariable String id,
Expand Down Expand Up @@ -490,7 +490,7 @@ class TaskController {
}
}

@PreAuthorize("hasPermission(this.getPipeline(#id)?.application, 'APPLICATION', 'WRITE')")
@PreAuthorize("hasPermission(this.getPipeline(#id)?.application, 'APPLICATION', 'EXECUTE')")
@RequestMapping(value = "/pipelines/{id}/stages/{stageId}/restart", method = RequestMethod.PUT)
Execution retryPipelineStage(
@PathVariable String id, @PathVariable String stageId) {
Expand Down

0 comments on commit 9179faf

Please sign in to comment.