Table configuration patterns
Owner-based access
ownerColumn matches their user ID.
Organization-based access
orgColumn matches any of their organization memberships.
Admin bypass
Group membership access
Scope-gated access
Inherited access
Access evaluation order
- Owner access (
ownerColumnmatch) - Group membership access (scope + membership)
- Bypass scopes (scope match)
RLS context
Injected automatically into everyctx.db query:
| Field | Description |
|---|---|
userId | Authenticated user’s ID |
role | User’s assigned role |
userScopes | User’s permission scopes |
userOrgIds | Organization IDs the user belongs to |
Pattern selection guide
| Question | Pattern |
|---|---|
| Each row has an owner? | ownerColumn |
| Multi-tenant data? | orgColumn |
| Admins should see everything? | Add bypassScopes |
| Team/group access needed? | Add groupAccess |
| Shared resource, no owner? | requiredScopes |
| Child of another table? | accessVia |

