import { createAccessControl } from "better-auth/plugins/access"; import { adminAc, defaultStatements } from "better-auth/plugins/admin/access"; export const statement = { ...defaultStatements, app: ["read", "create", "share", "update", "delete", "readAll"], quality: ["read", "create", "share", "update", "delete", "readAll"], logistics: ["read", "create", "share", "update", "delete", "readAll"], mobile: ["read", "create", "share", "update", "delete", "readAll"], notifications: ["read", "create", "share", "update", "delete", "readAll"], } as const; export const ac = createAccessControl(statement); export const user = ac.newRole({ app: ["read", "create"], notifications: ["read", "create"], }); export const manager = ac.newRole({ app: ["read", "create", "update"], mobile: ["read", "create", "update"], }); export const admin = ac.newRole({ app: ["read", "create", "update"], mobile: ["read", "create", "update"], user: ["create", "update"], }); export const systemAdmin = ac.newRole({ ...adminAc.statements, app: ["read", "create", "share", "update", "delete", "readAll"], quality: ["read", "create", "share", "update", "delete", "readAll"], mobile: ["read", "create", "share", "update", "delete", "readAll"], logistics: ["read", "create", "share", "update", "delete", "readAll"], notifications: ["read", "create", "share", "update", "delete", "readAll"], });