From 1b3f3f3f7e29206aebc1978779b4699745bfa8d6 Mon Sep 17 00:00:00 2001 From: "martin.dietrich" Date: Mon, 28 Oct 2024 13:12:13 +0100 Subject: [PATCH] hasAuthority -> hasRole --- .../muenchen/mobidam/rest/DatentransferController.java | 4 ++-- .../muenchen/mobidam/rest/SchnittstelleController.java | 10 +++++----- .../de/muenchen/mobidam/rest/ZuordnungController.java | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/DatentransferController.java b/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/DatentransferController.java index d1ed0ce..ddd0f53 100644 --- a/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/DatentransferController.java +++ b/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/DatentransferController.java @@ -50,14 +50,14 @@ public class DatentransferController { @Operation(summary = "Get all Datentransfers for Schnittstelle") @GetMapping("/{schnittstelleId}/{page}") - @PreAuthorize("hasAuthority(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") + @PreAuthorize("hasRole(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") public ResponseEntity> getBySchnittstelle(@PathVariable String schnittstelleId, @PathVariable int page) { return new ResponseEntity<>(datentransferService.getBySchnittstelle(schnittstelleId, page), HttpStatus.OK); } @Operation(summary = "Get first Datentransfer result state for Schnittstelle") @GetMapping("/latestResultState/{schnittstelleId}") - @PreAuthorize("hasAuthority(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") + @PreAuthorize("hasRole(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") public ResponseEntity getLatestResultStateBySchnittstelle(@PathVariable String schnittstelleId) { Optional datentransferDTO = datentransferService.getLatestResultStateBySchnittstelle(schnittstelleId); if (datentransferDTO.isPresent()) diff --git a/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/SchnittstelleController.java b/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/SchnittstelleController.java index 74467bf..d44b2b9 100644 --- a/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/SchnittstelleController.java +++ b/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/SchnittstelleController.java @@ -46,14 +46,14 @@ public class SchnittstelleController { @Operation(summary = "Creates schnittstelle") @PostMapping - @PreAuthorize("hasAuthority(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") + @PreAuthorize("hasRole(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") public ResponseEntity create(@Valid @RequestBody SchnittstelleCreateDTO schnittstelleCreateDTO) { return new ResponseEntity<>(schnittstelleService.create(schnittstelleCreateDTO), HttpStatus.OK); } @Operation(summary = "Get all schnittstelle") @GetMapping - @PreAuthorize("hasAuthority(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") + @PreAuthorize("hasRole(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") public ResponseEntity> getAll() { return new ResponseEntity<>(schnittstelleService.getAll(), HttpStatus.OK); } @@ -70,14 +70,14 @@ public ResponseEntity getStatus(@PathVariable("id") final String id) { @Operation(summary = "Deletes the schnittstelle with the given ID") @DeleteMapping("/{id}") - @PreAuthorize("hasAuthority(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") + @PreAuthorize("hasRole(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") public ResponseEntity deleteById(@PathVariable String id) { return this.schnittstelleService.deleteById(id) ? new ResponseEntity<>(HttpStatus.OK) : new ResponseEntity<>(HttpStatus.NOT_FOUND); } @Operation(summary = "Updates the schnittstelle") @PutMapping("/update") - @PreAuthorize("hasAuthority(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") + @PreAuthorize("hasRole(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") public ResponseEntity update(@Valid @RequestBody SchnittstelleDTO schnittstelleDTO) { Optional updatedSchnittstelleDTO = schnittstelleService.update(schnittstelleDTO); if (updatedSchnittstelleDTO.isPresent()) @@ -87,7 +87,7 @@ public ResponseEntity update(@Valid @RequestBody SchnittstelleDTO schnittstel @Operation(summary = "Get schnittstelle") @GetMapping("/{id}") - @PreAuthorize("hasAuthority(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") + @PreAuthorize("hasRole(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") public ResponseEntity getSchnittstelle(@PathVariable String id) { Optional schnittstelle = schnittstelleService.getById(id); return schnittstelle.map(schnittstelleDTO -> new ResponseEntity<>(schnittstelleDTO, HttpStatus.OK)) diff --git a/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/ZuordnungController.java b/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/ZuordnungController.java index 114eb29..6525c4e 100644 --- a/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/ZuordnungController.java +++ b/mobidam-sst-management-backend/src/main/java/de/muenchen/mobidam/rest/ZuordnungController.java @@ -53,7 +53,7 @@ public class ZuordnungController { @Operation(summary = "Generates a zuordnung") @PostMapping - @PreAuthorize("hasAuthority(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") + @PreAuthorize("hasRole(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") public ResponseEntity create(@Valid @RequestBody ZuordnungCreateDTO zuordnungCreateDTO) { Optional zuordnungDTO = zuordnungService.create(zuordnungCreateDTO); if (zuordnungDTO.isEmpty()) @@ -63,7 +63,7 @@ public ResponseEntity create(@Valid @RequestBody ZuordnungCreateDTO zuordnung @Operation(summary = "Returns the list of all zuordnungen of a schnittstelle") @GetMapping("/bySchnittstelle/{id}") - @PreAuthorize("hasAuthority(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") + @PreAuthorize("hasRole(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") public ResponseEntity> getAllById(@PathVariable String id) { List personDTOList = new ArrayList<>(); zuordnungService.getAllById(id) @@ -75,7 +75,7 @@ public ResponseEntity> getAllById(@PathVariable String id @Operation(summary = "Deletes the zuordnung with the given ID") @DeleteMapping("/{id}") - @PreAuthorize("hasAuthority(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") + @PreAuthorize("hasRole(T(de.muenchen.mobidam.security.AuthoritiesEnum).admin.name())") public ResponseEntity deleteById(@PathVariable String id) { return this.zuordnungService.deleteById(id) ? new ResponseEntity<>(HttpStatus.OK) : new ResponseEntity<>(HttpStatus.NOT_FOUND); }