Skip to content

restrictModel

restrictModel(model, access): ResourceModel

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

The resource as one user may see it: only readable fields remain, and a field is readOnly unless it is writable on create or update. search (and searchMatch) shrinks to readable fields, and tenant, softDelete and owner are dropped when their field is hidden, position when its field or its within is. The event catalogue, whose conditions may use any field, is dropped. Key columns always stay, because records are addressed by them.

Use the restricted model for everything user-facing (checking filters, sorts, queries, OpenAPI, /meta), so hidden fields cannot be referenced at all. Row filters from access rules (access.rowFilter) are checked against the full model instead and kept separate: they may use hidden or non-filterable columns.

ResourceModel

Pick<ResolvedAccess, "readableFields" | "writableFields">

ResourceModel