Kaizen
Browse modulesAccessaccess/sharedFunctions

Function: defineResourceAuthz()

function defineResourceAuthz(input: Record<string, ResourceAuthzDef>): ResourceAuthzRegistry;

Defined in: shared/access/registry.ts:174

Register, per resource type, which selector fields are indexable (and the DB column each maps to). authorizedWhere compiles only these into a Prisma where; non-indexable fields force a partial result.

Parameters

ParameterType
inputRecord<string, ResourceAuthzDef>

Returns

ResourceAuthzRegistry

Example

const registry = defineResourceAuthz({
  product: { indexableAttributes: { vendorOrgId: "vendorOrgId", status: "status" } },
});

On this page