import { createAccessControl } from "better-auth/plugins/access";
const statement = {
// Organization management
organization: ["create", "read", "update", "delete"],
// Member management
member: ["create", "read", "update", "delete"],
// Service management
service: ["create", "read", "update", "delete"],
// Appointment management
appointment: ["create", "read", "update", "delete"],
// Contact management
contact: ["create", "read", "update", "delete"],
// Availability management
availability: ["create", "read", "update", "delete"],
// Business hours management
businessHours: ["create", "read", "update", "delete"],
// Customer management
customer: ["create", "read", "update", "delete"],
} as const;
const ac = createAccessControl(statement);
// Basic member role - limited permissions
const member = ac.newRole({
organization: ["read"],
member: ["read"],
service: ["read"],
appointment: ["read", "create", "update"],
contact: ["read", "create"],
availability: ["read", "create", "update"],
});
// Admin role - extended permissions
const admin = ac.newRole({
organization: ["read", "update"],
member: ["read", "create", "update"],
service: ["create", "read", "update", "delete"],
appointment: ["create", "read", "update", "delete"],
contact: ["create", "read", "update", "delete"],
availability: ["create", "read", "update", "delete"],
businessHours: ["read", "update"],
customer: ["read", "update"],
});
// Owner role - full permissions
const owner = ac.newRole({
organization: ["create", "read", "update", "delete"],
member: ["create", "read", "update", "delete"],
service: ["create", "read", "update", "delete"],
appointment: ["create", "read", "update", "delete"],
contact: ["create", "read", "update", "delete"],
availability: ["create", "read", "update", "delete"],
businessHours: ["create", "read", "update", "delete"],
customer: ["create", "read", "update", "delete"],
});
export { ac, member, admin, owner };
import { createAccessControl } from "better-auth/plugins/access";
const statement = {
// Organization management
organization: ["create", "read", "update", "delete"],
// Member management
member: ["create", "read", "update", "delete"],
// Service management
service: ["create", "read", "update", "delete"],
// Appointment management
appointment: ["create", "read", "update", "delete"],
// Contact management
contact: ["create", "read", "update", "delete"],
// Availability management
availability: ["create", "read", "update", "delete"],
// Business hours management
businessHours: ["create", "read", "update", "delete"],
// Customer management
customer: ["create", "read", "update", "delete"],
} as const;
const ac = createAccessControl(statement);
// Basic member role - limited permissions
const member = ac.newRole({
organization: ["read"],
member: ["read"],
service: ["read"],
appointment: ["read", "create", "update"],
contact: ["read", "create"],
availability: ["read", "create", "update"],
});
// Admin role - extended permissions
const admin = ac.newRole({
organization: ["read", "update"],
member: ["read", "create", "update"],
service: ["create", "read", "update", "delete"],
appointment: ["create", "read", "update", "delete"],
contact: ["create", "read", "update", "delete"],
availability: ["create", "read", "update", "delete"],
businessHours: ["read", "update"],
customer: ["read", "update"],
});
// Owner role - full permissions
const owner = ac.newRole({
organization: ["create", "read", "update", "delete"],
member: ["create", "read", "update", "delete"],
service: ["create", "read", "update", "delete"],
appointment: ["create", "read", "update", "delete"],
contact: ["create", "read", "update", "delete"],
availability: ["create", "read", "update", "delete"],
businessHours: ["create", "read", "update", "delete"],
customer: ["create", "read", "update", "delete"],
});
export { ac, member, admin, owner };