From 55418e2f098193b0891129a19532608dce2abd9c Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Thu, 4 Jun 2026 06:49:49 -0500 Subject: [PATCH] refactor(new role): added in warehouse role --- backend/utils/auth.permissions.ts | 6 ++++++ frontend/src/lib/auth-client.ts | 10 +++++++++- frontend/src/lib/auth-permissions.ts | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/backend/utils/auth.permissions.ts b/backend/utils/auth.permissions.ts index a3398e9..049d617 100644 --- a/backend/utils/auth.permissions.ts +++ b/backend/utils/auth.permissions.ts @@ -8,6 +8,7 @@ export const statement = { logistics: ["read", "create", "update", "delete", "readAll"], mobile: ["read", "create", "update", "delete", "readAll"], openDock: ["read", "create", "update", "delete"], + warehouse: ["read", "create", "update", "delete"], notifications: ["read", "create", "update", "delete", "readAll"], } as const; @@ -17,17 +18,20 @@ export const user = ac.newRole({ app: ["read", "create"], notifications: ["read", "create"], openDock: ["read"], + warehouse: ["read"], }); export const manager = ac.newRole({ app: ["read", "create", "update"], mobile: ["read", "create", "update"], openDock: ["read", "create", "update"], + warehouse: ["read", "create"], }); export const transport = ac.newRole({ app: ["read", "create", "update"], openDock: ["read", "create", "update"], + warehouse: ["read", "create"], }); export const admin = ac.newRole({ @@ -35,6 +39,7 @@ export const admin = ac.newRole({ mobile: ["read", "create", "update"], user: ["create", "update", "ban"], openDock: ["read", "create", "update"], + warehouse: ["read", "create", "update"], }); export const systemAdmin = ac.newRole({ @@ -44,6 +49,7 @@ export const systemAdmin = ac.newRole({ mobile: ["read", "create", "update", "delete", "readAll"], logistics: ["read", "create", "update", "delete", "readAll"], notifications: ["read", "create", "update", "delete", "readAll"], + warehouse: ["read", "create", "update", "delete"], openDock: ["read", "create", "update", "delete"], }); diff --git a/frontend/src/lib/auth-client.ts b/frontend/src/lib/auth-client.ts index 74ff5a5..2c7ec57 100644 --- a/frontend/src/lib/auth-client.ts +++ b/frontend/src/lib/auth-client.ts @@ -6,7 +6,14 @@ import { } from "better-auth/client/plugins"; import { createAuthClient } from "better-auth/react"; -import { ac, admin, manager, systemAdmin, user } from "./auth-permissions"; +import { + ac, + admin, + manager, + systemAdmin, + transport, + user, +} from "./auth-permissions"; export const authClient = createAuthClient({ baseURL: `${window.location.origin}/lst/api/auth`, @@ -17,6 +24,7 @@ export const authClient = createAuthClient({ admin, user, manager, + transport, systemAdmin, }, }), diff --git a/frontend/src/lib/auth-permissions.ts b/frontend/src/lib/auth-permissions.ts index 0e05bdc..64bf457 100644 --- a/frontend/src/lib/auth-permissions.ts +++ b/frontend/src/lib/auth-permissions.ts @@ -14,6 +14,7 @@ export const selectableRoles: SelectableRole[] = [ { label: "User", value: "user" }, { label: "Manager", value: "manager" }, { label: "Transport", value: "transport" }, + { label: "Warehouse", value: "warehouse" }, { label: "Admin", value: "admin" }, { label: "System Admin", value: "systemAdmin" }, ]; @@ -25,6 +26,7 @@ export const statement = { logistics: ["read", "create", "update", "delete", "readAll"], mobile: ["read", "create", "update", "delete", "readAll"], openDock: ["read", "create", "update", "delete"], + warehouse: ["read", "create", "update", "delete"], notifications: ["read", "create", "update", "delete", "readAll"], } as const; @@ -34,17 +36,20 @@ export const user = ac.newRole({ app: ["read", "create"], notifications: ["read", "create"], openDock: ["read"], + warehouse: ["read"], }); export const manager = ac.newRole({ app: ["read", "create", "update"], mobile: ["read", "create", "update"], openDock: ["read", "create", "update"], + warehouse: ["read", "create"], }); export const transport = ac.newRole({ app: ["read", "create", "update"], openDock: ["read", "create", "update"], + warehouse: ["read", "create"], }); export const admin = ac.newRole({ @@ -52,6 +57,7 @@ export const admin = ac.newRole({ mobile: ["read", "create", "update"], user: ["create", "update", "ban"], openDock: ["read", "create", "update"], + warehouse: ["read", "create", "update"], }); export const systemAdmin = ac.newRole({ @@ -61,6 +67,7 @@ export const systemAdmin = ac.newRole({ mobile: ["read", "create", "update", "delete", "readAll"], logistics: ["read", "create", "update", "delete", "readAll"], notifications: ["read", "create", "update", "delete", "readAll"], + warehouse: ["read", "create", "update", "delete"], openDock: ["read", "create", "update", "delete"], });