HasPermissionProps
Defined in: packages/core/src/access/hasPermission.ts:39
Props required for the hasPermission({…}) function
access
The resolved config from defineAccess(). undefined
disables access control entirely — every check passes.
user
The authenticated user document. Roles are derived from
user[access.userRolesField] (string or string[]); a missing or empty
value falls back to access.anonRole
organization
The organization document forwarded to callbacks.
Only surfaces when access.orgCollectionSlug is configured.
resource
Subject name — a resource slug, a built-in subject
(e.g. "adminPanel"), or a custom resource name.
action
Action on resource, typed per subject.
data
Document/context forwarded to permission callbacks.
throwOnDenied
When true, throws VexAccessError instead of
scope
Which question to answer when a role’s check is a callback that
needs the document and data was not supplied:
"all" (default) asks “may they do this to every document” and resolves such
a check to false — fail-closed, never throws; "any" asks “may they do this
to at least one document” and resolves it to true (nav/sidebar/list gating —
row-level filtering happens separately in find/get); "doc" demands an
exact per-document answer and throws VexAccessError when data is missing,
which is what you want in edit views. Has no effect on static boolean checks,
and no effect when data is provided (the callback is always run against it).
Default
Section titled “Default”"all"Type Parameters
Section titled “Type Parameters”TSubjects
Section titled “TSubjects”TSubjects extends Record<string, SubjectEntry> = Record<string, SubjectEntry>
TSubject
Section titled “TSubject”TSubject extends keyof TSubjects & string = keyof TSubjects & string
TData extends object = { }
Properties
Section titled “Properties”access?
Section titled “access?”
optionalaccess?:VexAccessConfig<TSubjects, readonlyAccessResource[],string,string|undefined,Partial<Record<string,CustomActionsInput>>>
Defined in: packages/core/src/access/hasPermission.ts:44
action
Section titled “action”action:
TSubjects[TSubject]["action"]
Defined in: packages/core/src/access/hasPermission.ts:48
optionaldata?:TData
Defined in: packages/core/src/access/hasPermission.ts:49
organization?
Section titled “organization?”
optionalorganization?:Record<string,unknown>
Defined in: packages/core/src/access/hasPermission.ts:46
resource
Section titled “resource”resource:
TSubject
Defined in: packages/core/src/access/hasPermission.ts:47
scope?
Section titled “scope?”
optionalscope?:PermissionScope
Defined in: packages/core/src/access/hasPermission.ts:51
throwOnDenied?
Section titled “throwOnDenied?”
optionalthrowOnDenied?:boolean
Defined in: packages/core/src/access/hasPermission.ts:50
user:
Record<string,unknown> |null
Defined in: packages/core/src/access/hasPermission.ts:45