Skip to content

useVexAccess

useVexAccess<TSubjects>(): VexAccessConfig<TSubjects, readonly AccessResource[], string, string | undefined, Partial<Record<string, CustomActionsInput>>> | undefined

Defined in: packages/react/src/config/VexConfigContext.tsx:72

Reads the RBAC access matrix for this session — derived directly from VexConfigContext, the same config hasPermission/usePermission check against.

Deliberately reads the raw context instead of going through useVexConfig(): hooks/useCanAccessAdminPanel.ts renders this on public pages where no VexConfigProvider is mounted (the normal state of every public page), so this must degrade to undefined there instead of throwing.

TSubjects extends Record<string, SubjectEntry> = Record<string, SubjectEntry>

VexAccessConfig<TSubjects, readonly AccessResource[], string, string | undefined, Partial<Record<string, CustomActionsInput>>> | undefined

The access config for the session, or undefined when RBAC is not configured OR no provider is mounted — hasPermission treats undefined as the escape hatch and allows every check, not the reverse.