Skip to content

Commit

Permalink
GatherQueue: Require PRIV_CONTROL_GATHERER for Delete/Retry all button
Browse files Browse the repository at this point in the history
These functions were inadvertently available to all users.
  • Loading branch information
ato committed Jul 3, 2024
1 parent 2ae40f8 commit 05b3554
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui/resources/templates/gather/GatherQueue.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ <h2 id="queued">Scheduled for today</h2>

<section>
<h2>Failed</h2>
<form th:action="@{/queue/retry-all}" method="post">
<form sec:authorize="hasAuthority('PRIV_CONTROL_GATHERER')" th:action="@{/queue/retry-all}" method="post">
<button type="submit" class="btn-danger">Retry all</button>
</form>
<form th:action="@{/queue/delete-all-failed}" method="post">
<form sec:authorize="hasAuthority('PRIV_CONTROL_GATHERER')" th:action="@{/queue/delete-all-failed}" method="post">
<button type="submit" class="btn-danger">Delete all</button>
</form>

Expand Down
2 changes: 2 additions & 0 deletions ui/src/pandas/gather/GatherQueueController.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ public String unpauseGathers() {
}

@PostMapping("/queue/retry")
@PreAuthorize("hasAuthority('PRIV_CONTROL_GATHERER')")
@Transactional
public String retry(@RequestParam("instance") Instance instance) {
instanceService.retryAfterFailure(instance, userService.getCurrentUser());
return "redirect:/queue";
}

@PostMapping("/queue/retry-all")
@PreAuthorize("hasAuthority('PRIV_CONTROL_GATHERER')")
@Transactional
public String retryAll() {
for (Instance instance : listFailedInstances()) {
Expand Down

0 comments on commit 05b3554

Please sign in to comment.