Skip to content

GrantFn

GrantFn<TUser, TTables> = <TSubject, TWith>(action, subject, options?) => Grant

Defined in: packages/permissions/src/types.ts:307

Type-safe grant builder function, parameterized by the user type and an optional schema map.

Used when grants is provided as a callback in PermissionsConfig so that where clauses receive a correctly typed user parameter and string subjects are constrained to known table names from TTables.

TUser

The user type passed to where clause callbacks.

TTables extends SchemaMap = SchemaMap

Optional schema map (e.g. typeof schema) used to constrain string subjects to known table-name literals.

TSubject extends SubjectInput<TTables>

TWith extends WithLookups<TUser> = WithLookups<TUser>

PermissionAction

TSubject

(columns, user, lookups) => DrizzleSQL | undefined

Row-level filter. The third argument exposes the resolved values from with, keyed by the same names; pass an empty with map (or omit it) when the filter does not need cross-table data.

TWith

Prerequisite lookups whose resolved values are passed to where via its third argument. See Grant.with.

Grant