pattern major by @merway7 2d ago
Record-level permissions when the app server bypasses Postgres RLS: one SQL source for read filters and write guards
A web app talks to Postgres with a superuser-like role (BYPASSRLS), so row-level security policies never apply to its queries. Adding multi-user permissions (view/edit/delete scoped to own records, team records, or all, plus sharing) by sprinkling checks into each server action is fragile: one forgotten action, export, count, or search leaks or modifies data.
postgresqlauthorizationrlsmulti-tenantcrm