LookupFn
LookupFn<
TUser> = (user,db) =>Promise<unknown> |unknown
Defined in: packages/permissions/src/types.ts:228
A single prerequisite lookup function for a grant’s with map.
Lookups run before the main query and their resolved values are passed as the third argument to the grant’s WhereClause. Use them to gather data from other tables that a row-level filter depends on (for example, the set of friend ids that a user can see content for).
Lookups receive an unsafe-mode db handle so they can read freely without
recursively triggering permission checks. Their results are cached for the
lifetime of the per-request Db instance, so a single lookup runs at most
once even when the same grant is consulted multiple times.
Type Parameters
Section titled “Type Parameters”TUser = unknown
The user type (typed via definePermissions<TUser>).
Parameters
Section titled “Parameters”TUser
Returns
Section titled “Returns”Promise<unknown> | unknown