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:
co-authored by
Claude Sonnet 5.5
parent
54c6d606ff
commit
1c9d9423c0
@@ -0,0 +1,12 @@
|
||||
rls_enabled=false, so only the SQL in @SQLUpdate and @SQLDelete stands between tenants.
|
||||
tenantA edits its own receipt:
|
||||
update receipt set memo=? where id=? and tenant_id=coalesce(?,tenant_id) [a-edited, 1, tenantA]
|
||||
root edits tenantB's receipt:
|
||||
update receipt set memo=? where id=? and tenant_id=coalesce(?,tenant_id) [b-edited-by-root, 2, null]
|
||||
tenantA tries to delete tenantB's receipt through a reference:
|
||||
-> rejected: ObjectNotFoundException: No row with the given identifier exists for entity [com.ankurm.tenant.Receipt with id '2']
|
||||
tenantB's receipt still exists: true
|
||||
tenantA deletes its own receipt:
|
||||
delete from receipt where id=? and tenant_id=coalesce(?,tenant_id) [1, tenantA]
|
||||
root deletes tenantB's receipt:
|
||||
delete from receipt where id=? and tenant_id=coalesce(?,tenant_id) [2, null]
|
||||
Reference in New Issue
Block a user