Skip to content

AccessContext

AccessContext = object

Defined in: packages/schema/src/access/types.ts:16

What an access rule is given: who asks, for which operation, and where.

[key: string]: unknown

optional holds?: (capability) => boolean

Defined in: packages/schema/src/access/types.ts:35

Set by the resolver for field rules: whether the caller holds a capability on every row and field, such as workflow_runs.read, for a field that shows what another resource holds. A wildcard over resources such as *.read does not count; without roles, it is what an operation without a rule gets.

string

boolean


optional model?: ResourceModel

Defined in: packages/schema/src/access/types.ts:37

Set by the resolver; scoped capabilities (.own) need model.owner.


optional operation?: AccessAction

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

The operation being decided.


optional organization?: object

Defined in: packages/schema/src/access/types.ts:24

With organizations, the one the request works in; .tenant resources are scoped to it already.

id: string | number

The organization’s id.

optional role?: "owner" | "admin" | "member"

The caller’s organization role there, read from the auth store for this request; absent for someone who is no member.


optional record?: unknown

Defined in: packages/schema/src/access/types.ts:22

The record the operation is on, when there is one.


optional user?: AccessUser

Defined in: packages/schema/src/access/types.ts:18

Always set by the server; optional in the type so rules stay callable with a bare context.