Organization User
Organization User is a user’s membership in a specific organization, including org-level role, membership status, and site assignments.At a Glance
- One membership per (organization, user) pair
- Role (RBAC) drives permissions; site assignments scope them
- Status lifecycle:
INVITED → ACTIVE → INACTIVE - Tags allow lightweight categorization/filters
Roles (RBAC)
- Viewer: read-only access to assigned sites
- Collector: can submit/edit data on assigned sites
- Approver: can approve submissions within assigned sites
- Manager: manage users, sites, forms within assigned sites
- Owner: full organizational control
Status Lifecycle
- INVITED (default): created via invitation; limited until acceptance
- ACTIVE: full membership; operations allowed per role/scope
- INACTIVE: disabled membership; no access
Constraints & Integrity
- Unique membership per organization:
(organizationId, userId) - Deleting a membership cascades its site assignments (via
OrganizationUserSiteFK) - Owner cannot grant themselves more than OWNER; privilege changes follow role guard rules
Site Access (ABAC)
Site access is assigned via the Organization User Site junction. Effective access includes all descendants of the directly assigned sites (computed with a recursive query). Assigning the root site grants access to the entire organization.Typical Operations
- List organization users (filtered by caller’s site access)
- Invite a user with role and site assignments
- Update a user’s role and optionally (re)assign sites
- Assign sites to multiple users (bulk: replace/add/remove)
Security & Filtering
- Reads are restricted: viewers/collectors see users inside their accessible site tree; managers/owners see all.
- Writes are restricted to managers/owners and only within sites they can access.
- Row Level Security (RLS) and helper guards ensure context safety.
Tips & Edge Cases
- Users with no site assignments still appear in lists (visible to managers/owners); their effective access is empty.
- Inviting a user to the root site implicitly grants full organization access (root + descendants).
- Bulk operations support
replace,add, andremovesemantics—preferreplacefor idempotent updates.
Related Concepts
- User — global identity and profile
- Organization User Site — site-level access for a membership

