Prevents Hunters from accessing hunt information before it starts
This commit is contained in:
@@ -13,6 +13,7 @@ import net.halfbinary.scavengerhuntapi.model.response.ItemResponse
|
||||
import net.halfbinary.scavengerhuntapi.service.HuntService
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.security.access.prepost.PreAuthorize
|
||||
import org.springframework.security.core.Authentication
|
||||
import org.springframework.web.bind.annotation.DeleteMapping
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.PatchMapping
|
||||
@@ -27,8 +28,8 @@ import org.springframework.web.bind.annotation.RestController
|
||||
class ItemController(private val huntService: HuntService) {
|
||||
|
||||
@GetMapping
|
||||
fun getItemsForHunt(@PathVariable huntId: HuntId): ResponseEntity<List<ItemResponse>> {
|
||||
return ResponseEntity.ok(huntService.getItemsForHunt(huntId).map { it.toResponse() })
|
||||
fun getItemsForHunt(@PathVariable huntId: HuntId, authentication: Authentication): ResponseEntity<List<ItemResponse>> {
|
||||
return ResponseEntity.ok(huntService.getItemsForHunt(huntId, authentication.name).map { it.toResponse() })
|
||||
}
|
||||
|
||||
@GetMapping("/{itemId}")
|
||||
|
||||
Reference in New Issue
Block a user