From 2befbac54ad26785eca32b246162fa286c7b1482 Mon Sep 17 00:00:00 2001 From: BenjaminNH <1249376374@qq.com> Date: Thu, 31 Jul 2025 11:34:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BC=80=E6=94=BE=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E9=A2=84=E7=BA=A6=E5=92=8C=E6=88=91=E7=9A=84=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E7=BB=99=E5=9B=A2=E9=98=9F?= =?UTF-8?q?=E8=B4=9F=E8=B4=A3=E4=BA=BA=E5=92=8C=E8=AE=BE=E5=A4=87=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipreservebackend/controller/DeviceController.java | 4 ++-- .../equipreservebackend/controller/ReservationController.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/github/benjamin/equipreservebackend/controller/DeviceController.java b/src/main/java/github/benjamin/equipreservebackend/controller/DeviceController.java index 41cfbc8..8382a88 100644 --- a/src/main/java/github/benjamin/equipreservebackend/controller/DeviceController.java +++ b/src/main/java/github/benjamin/equipreservebackend/controller/DeviceController.java @@ -30,7 +30,7 @@ public class DeviceController { private final ReservationService reservationService; - @PreAuthorize("hasRole('USER')") + @PreAuthorize("hasAnyRole('USER', 'LEADER', 'DEVICE_ADMIN')") @GetMapping public ResponseResult> getUserDevices(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size, @@ -40,7 +40,7 @@ public class DeviceController { return ResponseResult.success(res); } - @PreAuthorize("hasRole('USER')") + @PreAuthorize("hasAnyRole('USER', 'LEADER', 'DEVICE_ADMIN')") @GetMapping("/unavailable-times/{id}") public ResponseResult> getUnavailableTimes(@PathVariable Long id) { List res = reservationService.getUnavailableTimes(id); diff --git a/src/main/java/github/benjamin/equipreservebackend/controller/ReservationController.java b/src/main/java/github/benjamin/equipreservebackend/controller/ReservationController.java index dbdf9fe..eeefb2a 100644 --- a/src/main/java/github/benjamin/equipreservebackend/controller/ReservationController.java +++ b/src/main/java/github/benjamin/equipreservebackend/controller/ReservationController.java @@ -29,14 +29,14 @@ public class ReservationController { private final ReservationService reservationService; - @PreAuthorize("hasRole('USER')") + @PreAuthorize("hasAnyRole('USER', 'LEADER', 'DEVICE_ADMIN')") @PostMapping public ResponseResult addReservation(@RequestBody Reservation reservation) { reservationService.addReservation(reservation); return ResponseResult.success(); } - @PreAuthorize("hasRole('USER')") + @PreAuthorize("hasAnyRole('USER', 'LEADER', 'DEVICE_ADMIN')") @GetMapping("/{userId}") public ResponseResult> getUserReservation(@PathVariable("userId") Long userId, @RequestParam(defaultValue = "1") Integer page,