accessScope() function
Build the middleware restricting statements to the records a caller may see.
Signature:
export declare function accessScope(input: AccessScopeOptions): SqlMiddleware;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
input |
Per-table scope config and one resolver per level. |
Returns:
SqlMiddleware
Middleware for the middleware array of the postgres() factory.
Remarks
The predicate is AND-ed onto whatever the statement already filters by, so a caller cannot widen out of scope and no scope column can be spoofed by supplying it in the query. insert is deliberately untouched: there is no existing row to filter, and ownership is stamped by stamp.
Reads are filtered across the **whole statement**. Prisma Next compiles a relation read into one statement holding several selects, so a filter on the outermost from alone would return out-of-scope rows through any include — the exact bypass the Prisma 7 extension documented as a limitation.
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.