Skip to content

ResolveOptions

ResolveOptions = object

Defined in: packages/schema/src/access/resolve.ts:20

How resolveAccess decides what the resource’s rules leave open.

optional defaultAccess?: "allow" | "deny"

Defined in: packages/schema/src/access/resolve.ts:42

Overrides what an operation without a rule does. Without roles the default is allow, the single-admin case; with roles it is the capability check above. Choosing allow together with roles is an explicit opt-in, see accessWarnings.


optional roles?: object

Defined in: packages/schema/src/access/resolve.ts:27

The project’s roles. When given, an operation without a rule is denied unless the user’s roles grant <resource>.<action> (so admin’s * still passes). Fields without a rule follow their resource, within the fields the roles list for the capability. With an anonymous role, a caller holding only that role needs its capability even where a rule or defaultAccess would allow.

can: (capability) => Rule

The rule allowing a capability, as defineRoles makes it.

any

Rule

optional definitions?: Record<string, unknown>

The roles by name, to tell whether the project has an anonymous role.

optional fields?: (user, capability, model) => readonly string[] | undefined

The fields the user’s roles list for a capability on the resource, or undefined for every field.

AccessUser

string

ResourceModel

readonly string[] | undefined

optional holds?: (user, capability, model?) => boolean

Whether the user’s roles grant all of a capability, as defineRoles makes it; the gate of API functions.

AccessUser

any

Pick<ResourceModel, "explicitGrants">

boolean