Skip to content

Commit

Permalink
hasAuthority -> hasRole
Browse files Browse the repository at this point in the history
  • Loading branch information
martind260 committed Oct 28, 2024
1 parent ba41239 commit 1b3f3f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Iterable<DatentransferDTO>> 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> datentransferDTO = datentransferService.getLatestResultStateBySchnittstelle(schnittstelleId);
if (datentransferDTO.isPresent())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SchnittstelleDTO> 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<Iterable<SchnittstelleDTO>> getAll() {
return new ResponseEntity<>(schnittstelleService.getAll(), HttpStatus.OK);
}
Expand All @@ -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<Void> 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<SchnittstelleDTO> updatedSchnittstelleDTO = schnittstelleService.update(schnittstelleDTO);
if (updatedSchnittstelleDTO.isPresent())
Expand All @@ -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<SchnittstelleDTO> getSchnittstelle(@PathVariable String id) {
Optional<SchnittstelleDTO> schnittstelle = schnittstelleService.getById(id);
return schnittstelle.map(schnittstelleDTO -> new ResponseEntity<>(schnittstelleDTO, HttpStatus.OK))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> zuordnungDTO = zuordnungService.create(zuordnungCreateDTO);
if (zuordnungDTO.isEmpty())
Expand All @@ -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<Iterable<ZuordnungDTO>> getAllById(@PathVariable String id) {
List<ZuordnungDTO> personDTOList = new ArrayList<>();
zuordnungService.getAllById(id)
Expand All @@ -75,7 +75,7 @@ public ResponseEntity<Iterable<ZuordnungDTO>> 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<Void> deleteById(@PathVariable String id) {
return this.zuordnungService.deleteById(id) ? new ResponseEntity<>(HttpStatus.OK) : new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
Expand Down

0 comments on commit 1b3f3f3

Please sign in to comment.