{"repo":"s1owjke/prisma-rls","free":true,"listed":false,"github":"https://github.com/s1owjke/prisma-rls","clone":"git clone https://github.com/s1owjke/prisma-rls.git","description":"Prisma client extension for row-level security on any database","language":"TypeScript","stars":16,"topics":["database","prisma","prisma-client","prisma-extension","rls","row-level-security"],"license":"MIT","category":"databases-storage","readme_excerpt":"Prisma RLS Row-Level Security (RLS) traditionally requires databases with native support and custom security policies for each table. This library provides an alternative: a Prisma client extension that automatically adds \"where\" clauses to all model queries. This method works without database-side RLS support (e.g., in MySQL). Note that this extension doesn't apply to raw queries. For those, you must handle them manually or choose database with built-in support. Compatibility prisma-rls @prisma/client ---------- -------------------- 1.x =7.0.0 0.x =4.16.1, <7.0.0 Version 7 introduced a new client generator provider = \"prisma-client\" with ESM support, which is a breaking change for this library's DMMF handling, see Obtaining the DMMF. If you're on an older Prisma Client, just stay on the 0.x release. Quick start Define shared types: Define permissions for each model in your schema, they also can be a function: In most cases, you will have multiple roles. To define them in a type-safe manner, follow this pattern: Prisma extensions don't support dynamic contexts, so create an extension per context: After that, all non-raw queries will be executed according to the defined permissions. Edge cases Obtaining the DMMF The new client generator provider = \"prisma-client\" no longer exposes Prisma.dmmf . Until an official replacement lands, these workarounds rely on internal, unstable Prisma APIs and are meant to bridge this transition period. Prisma internals - parse the schema at runt","default_branch":null,"files":null,"tree":[],"storefront":"/r/s1owjke","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/s1owjke/prisma-rls/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}