refactor: harmonize hasRole conditions

This commit is contained in:
Gauthier Roebroeck 2020-03-05 11:32:30 +08:00
parent 838d02fd0e
commit f052d2c862
5 changed files with 7 additions and 7 deletions

View file

@ -16,7 +16,7 @@ private val logger = KotlinLogging.logger {}
@RestController
@RequestMapping("api/v1/admin")
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PreAuthorize("hasRole('ADMIN')")
class AdminController(
private val asyncOrchestrator: AsyncOrchestrator,
private val bookRepository: BookRepository

View file

@ -317,7 +317,7 @@ class BookController(
} ?: throw ResponseStatusException(HttpStatus.NOT_FOUND)
@PostMapping("api/v1/books/{bookId}/analyze")
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED)
fun analyze(@PathVariable bookId: Long) {
bookRepository.findByIdOrNull(bookId)?.let { book ->

View file

@ -16,7 +16,7 @@ import kotlin.streams.asSequence
@RestController
@RequestMapping("api/v1/filesystem", produces = [MediaType.APPLICATION_JSON_VALUE])
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PreAuthorize("hasRole('ADMIN')")
class FileSystemController {
private val fs = FileSystems.getDefault()

View file

@ -90,7 +90,7 @@ class LibraryController(
}
@PostMapping("{libraryId}/scan")
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED)
fun scan(@PathVariable libraryId: Long) {
libraryRepository.findByIdOrNull(libraryId)?.let { library ->
@ -103,7 +103,7 @@ class LibraryController(
}
@PostMapping("{libraryId}/analyze")
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED)
fun analyze(@PathVariable libraryId: Long) {
libraryRepository.findByIdOrNull(libraryId)?.let { library ->

View file

@ -206,7 +206,7 @@ class SeriesController(
}
@PostMapping("{seriesId}/analyze")
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED)
fun analyze(@PathVariable seriesId: Long) {
seriesRepository.findByIdOrNull(seriesId)?.let { series ->
@ -219,7 +219,7 @@ class SeriesController(
}
@PatchMapping("{seriesId}/metadata")
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PreAuthorize("hasRole('ADMIN')")
fun updateMetadata(
@PathVariable seriesId: Long,
@RequestBody newMetadata: SeriesMetadataUpdateDto