Add rls-safe-mode module: Hibernate 8.0.0.CR2 HQL safe mode and PostgreSQL row-level security for @TenantId

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6ZEVHGaYy15HAxRzy
This commit is contained in:
Ankur Mhatre
2026-12-01 08:08:31 +05:30
co-authored by Claude Sonnet 5.5
parent 54c6d606ff
commit 1c9d9423c0
20 changed files with 817 additions and 1 deletions
@@ -0,0 +1,11 @@
select relname, relrowsecurity, relforcerowsecurity from pg_class (invoice, receipt)
invoice rowsecurity=true force=true
receipt rowsecurity=true force=true
select tablename, policyname, cmd, qual, with_check from pg_policies
table=invoice policy=hibernate_tenant_isolation cmd=ALL
using (((tenant_id)::text = ((NULLIF(current_setting('hibernate.tenant_id'::text, true), ''::text))::character varying(255))::text) OR COALESCE((NULLIF(current_setting('hibernate.tenant_id_root'::text, true), ''::text))::boolean, false))
with check (((tenant_id)::text = ((NULLIF(current_setting('hibernate.tenant_id'::text, true), ''::text))::character varying(255))::text) OR COALESCE((NULLIF(current_setting('hibernate.tenant_id_root'::text, true), ''::text))::boolean, false))
table=receipt policy=hibernate_tenant_isolation cmd=ALL
using (((tenant_id)::text = ((NULLIF(current_setting('hibernate.tenant_id'::text, true), ''::text))::character varying(255))::text) OR COALESCE((NULLIF(current_setting('hibernate.tenant_id_root'::text, true), ''::text))::boolean, false))
with check (((tenant_id)::text = ((NULLIF(current_setting('hibernate.tenant_id'::text, true), ''::text))::character varying(255))::text) OR COALESCE((NULLIF(current_setting('hibernate.tenant_id_root'::text, true), ''::text))::boolean, false))