fix: allow groomer and receptionist roles to read staff records
GRO-162: Groomer role was blocked from GET /api/staff with 403 because the /staff/* route guard required "manager" role for all HTTP methods. Changed the guard to only require "manager" for write operations (POST/PUT/PATCH/DELETE), matching the pattern used for /clients and /appointments where all roles can read but only managers (or managers + receptionists) can write. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -82,8 +82,9 @@ api.use("*", authMiddleware);
|
||||
api.use("*", resolveStaffMiddleware);
|
||||
|
||||
// ── Role guards ────────────────────────────────────────────────────────────────
|
||||
// Manager-only: staff, admin settings, reports, invoices, impersonation
|
||||
api.use("/staff/*", requireRole("manager"));
|
||||
// Staff: all roles may read; only managers may write (POST/PUT/PATCH/DELETE)
|
||||
api.on(["POST", "PUT", "PATCH", "DELETE"], "/staff/*", requireRole("manager"));
|
||||
// Manager-only: admin settings, reports, invoices, impersonation
|
||||
api.use("/admin/*", requireRole("manager"));
|
||||
api.use("/reports/*", requireRole("manager"));
|
||||
api.use("/invoices/*", requireRole("manager"));
|
||||
|
||||
Reference in New Issue
Block a user