Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:29:10 +08:00
commit 657f1e3da3
29 changed files with 2738 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
# Row Level Security Examples
**RLS policy patterns for multi-tenant isolation.**
## Enable RLS
```sql
ALTER TABLE users ENABLE ROW LEVEL SECURITY;
```
## Tenant Isolation Policy
```sql
CREATE POLICY "tenant_isolation" ON users
FOR ALL TO authenticated
USING (tenant_id = (current_setting('request.jwt.claims')::json->>'tenant_id')::uuid);
```
## Admin Override Policy
```sql
CREATE POLICY "admin_access" ON users
FOR ALL TO admin
USING (true);
```
**See [../reference/rls-policies.md](../reference/rls-policies.md) for complete RLS guide.**