Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
// Route -> required module name. Values are the seeded aclMenu `name` column (BO_USERS, ...), NOT the `desc`
|
|
// display label: the route gate RequireModule -> useAdminAuth().hasModule(x) matches a flattened aclMenu node by
|
|
// `name` or `url` only, so a desc label here never matches and a granted user would wrongly see the
|
|
// not-authorised state.
|
|
export const ROUTE_MODULES: Record<string, string> = {
|
|
"/users": "BO_USERS",
|
|
"/roles": "BO_ROLES",
|
|
"/events": "BO_EVENTS",
|
|
// add-event-ticket-orders: /events/[uuid]/orders and its order pages gate on this key.
|
|
"/event-orders": "BO_EVENT_TICKETS",
|
|
"/interests": "BO_INTERESTS",
|
|
"/event-leads": "BO_EVENT_LEADS",
|
|
"/pages": "BO_PAGES",
|
|
"/leads": "BO_LEADS",
|
|
"/emails": "BO_EMAILS",
|
|
"/login-security": "BO_LOGIN_SECURITY",
|
|
"/audit-log": "BO_AUDIT_LOG",
|
|
"/whatsapp": "BO_WHATSAPP",
|
|
"/messages": "BO_MESSAGES",
|
|
"/locales": "BO_LOCALES",
|
|
};
|
|
|
|
export function requiredModuleFor(pathname: string): string | undefined {
|
|
return ROUTE_MODULES[pathname];
|
|
}
|
|
|
|
export function requiredModulesFor(pathname: string): readonly string[] | undefined {
|
|
const single = ROUTE_MODULES[pathname];
|
|
return single ? [single] : undefined;
|
|
}
|