Ajout d'une permission pour l'API des kits de retouche
This commit is contained in:
parent
ced46dd83d
commit
d7da1654e2
|
@ -2,11 +2,10 @@ package dev.fyloz.colorrecipesexplorer.model
|
|||
|
||||
import org.springframework.security.core.GrantedAuthority
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority
|
||||
import java.util.*
|
||||
|
||||
enum class EmployeePermission(
|
||||
val impliedPermissions: List<EmployeePermission> = listOf(),
|
||||
val deprecated: Boolean = false
|
||||
val impliedPermissions: List<EmployeePermission> = listOf(),
|
||||
val deprecated: Boolean = false
|
||||
) {
|
||||
READ_FILE,
|
||||
WRITE_FILE(listOf(READ_FILE)),
|
||||
|
@ -35,19 +34,21 @@ enum class EmployeePermission(
|
|||
|
||||
ADD_TO_INVENTORY(listOf(VIEW_CATALOG)),
|
||||
DEDUCT_FROM_INVENTORY(listOf(VIEW_RECIPES)),
|
||||
GENERATE_TOUCH_UP_KIT,
|
||||
|
||||
ADMIN(
|
||||
listOf(
|
||||
EDIT_CATALOG,
|
||||
listOf(
|
||||
EDIT_CATALOG,
|
||||
|
||||
REMOVE_RECIPES,
|
||||
REMOVE_USERS,
|
||||
REMOVE_CATALOG,
|
||||
REMOVE_RECIPES,
|
||||
REMOVE_USERS,
|
||||
REMOVE_CATALOG,
|
||||
|
||||
PRINT_MIXES,
|
||||
ADD_TO_INVENTORY,
|
||||
DEDUCT_FROM_INVENTORY
|
||||
)
|
||||
PRINT_MIXES,
|
||||
ADD_TO_INVENTORY,
|
||||
DEDUCT_FROM_INVENTORY,
|
||||
GENERATE_TOUCH_UP_KIT
|
||||
)
|
||||
),
|
||||
|
||||
// deprecated permissions
|
||||
|
|
|
@ -4,10 +4,12 @@ import dev.fyloz.colorrecipesexplorer.service.files.TouchUpKitService
|
|||
import org.springframework.core.io.ByteArrayResource
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.security.access.prepost.PreAuthorize
|
||||
import org.springframework.web.bind.annotation.*
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/touchup")
|
||||
@PreAuthorize("hasAuthority('GENERATE_TOUCH_UP_KIT')")
|
||||
class TouchUpKitController(
|
||||
private val touchUpKitService: TouchUpKitService
|
||||
) {
|
||||
|
|
|
@ -19,6 +19,7 @@ private class TouchUpKitServiceTestContext {
|
|||
val touchUpKitService = spyk(TouchUpKitServiceImpl(fileService, creProperties))
|
||||
val pdfDocumentData = mockk<ByteArrayResource>()
|
||||
val pdfDocument = mockk<PdfDocument> {
|
||||
mockkStatic(PdfDocument::toByteArrayResource)
|
||||
mockkStatic(PdfDocument::toByteArrayResource)
|
||||
every { toByteArrayResource() } returns pdfDocumentData
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue