Organization Membership Service
Component Detail
Service Layer
high complexity
mobilebackend
2
Dependencies
2
Dependents
7
Entities
0
Integrations
Description
Manages the stream of OrganizationMembership objects fetched at login and cached in Drift. Orchestrates the full context-switch flow: POST /api/v1/sessions/context, atomic token swap in the API HTTP Client, mutation outbox quarantine for the previous context, and module registry re-evaluation for the new tenant.
organization-membership-service
Responsibilities
- Fetch and cache organization memberships at login via GET /api/v1/users/me/memberships
- Execute context switch via POST /api/v1/sessions/context and atomically replace the access token
- Quarantine or flush pending Mutation Outbox entries scoped to the previous organization before completing the switch
- Notify the Module Registry Service to re-evaluate the enabled area set for the newly active tenant
- Validate that the requested organization context is active and not suspended before issuing the switch
Interfaces
getMemberships(): Stream<List<OrganizationMembership>>
getActiveContext(): OrganizationMembership
switchContext(organizationId: String): Future<void>
refreshMemberships(): Future<void>
isContextSwitchAllowed(organizationId: String): Future<bool>
Relationships
Dependencies (2)
Components this component depends on
Dependents (2)
Components that depend on this component
Related Data Entities (7)
Data entities managed by this component