refactor(new role): added in warehouse role

This commit is contained in:
2026-06-04 06:49:49 -05:00
parent 5281118596
commit 55418e2f09
3 changed files with 22 additions and 1 deletions

View File

@@ -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"],
});

View File

@@ -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,
},
}),

View File

@@ -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"],
});