ROLE_COUNTER

This commit is contained in:
2024-11-30 11:02:45 +01:00
parent 5d6a0ae3e1
commit afc46e3c41
6 changed files with 21 additions and 13 deletions
@@ -9,6 +9,8 @@ public final class AuthoritiesConstants {
public static final String USER = "ROLE_USER";
public static final String COUNTER = "ROLE_COUNTER";
public static final String ANONYMOUS = "ROLE_ANONYMOUS";
private AuthoritiesConstants() {}
@@ -52,7 +52,7 @@ public class EventResource {
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("")
@Secured({ AuthoritiesConstants.ADMIN })
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
public ResponseEntity<Event> createEvent(@Valid @RequestBody Event event) throws URISyntaxException {
LOG.debug("REST request to save Event : {}", event);
if (event.getId() != null) {
@@ -65,7 +65,7 @@ public class EventResource {
}
@PostMapping("/{id}/settle")
@Secured({ AuthoritiesConstants.ADMIN })
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
public ResponseEntity<Optional<Event>> settleEvent(@RequestBody Optional<Event> event) throws URISyntaxException {
event = eventService.settle(event.orElse(null));
return ResponseEntity.ok()
@@ -84,7 +84,7 @@ public class EventResource {
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/{id}")
@Secured({ AuthoritiesConstants.ADMIN })
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
public ResponseEntity<Event> updateEvent(@PathVariable(value = "id", required = false) final Long id, @Valid @RequestBody Event event)
throws URISyntaxException {
LOG.debug("REST request to update Event : {}, {}", id, event);
@@ -116,7 +116,7 @@ public class EventResource {
* or with status {@code 500 (Internal Server Error)} if the event couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@Secured({ AuthoritiesConstants.ADMIN })
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
@PatchMapping(value = "/{id}", consumes = { "application/json", "application/merge-patch+json" })
public ResponseEntity<Event> partialUpdateEvent(
@PathVariable(value = "id", required = false) final Long id,
@@ -50,7 +50,7 @@ public class TransactionResource {
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("")
@Secured({ AuthoritiesConstants.ADMIN })
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
public ResponseEntity<Transaction> createTransaction(@RequestBody Transaction transaction) throws URISyntaxException {
LOG.debug("REST request to save Transaction : {}", transaction);
if (transaction.getId() != null) {
@@ -72,7 +72,7 @@ public class TransactionResource {
* or with status {@code 500 (Internal Server Error)} if the transaction couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@Secured({ AuthoritiesConstants.ADMIN })
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
@PutMapping("/{id}")
public ResponseEntity<Transaction> updateTransaction(
@PathVariable(value = "id", required = false) final Long id,
@@ -107,7 +107,7 @@ public class TransactionResource {
* or with status {@code 500 (Internal Server Error)} if the transaction couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@Secured({ AuthoritiesConstants.ADMIN })
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
@PatchMapping(value = "/{id}", consumes = { "application/json", "application/merge-patch+json" })
public ResponseEntity<Transaction> partialUpdateTransaction(
@PathVariable(value = "id", required = false) final Long id,