558 B
558 B
Row Level Security Examples
RLS policy patterns for multi-tenant isolation.
Enable RLS
ALTER TABLE users ENABLE ROW LEVEL SECURITY;
Tenant Isolation Policy
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
CREATE POLICY "admin_access" ON users
FOR ALL TO admin
USING (true);
See ../reference/rls-policies.md for complete RLS guide.