Users & organizations
The default users and organizations setup is this:
- All subscriptions are tied to an
organization
(rather than auser
) - All
users
must belong to anorganization
- An
organization
can have manyusers
- A
user
can belong to multipleorganizations
This model is extremely flexible as it supports both B2C (one organization = one user) and B2B (one organization = many users) from the start. If you are doing B2C you can mostly ignore this section. That being said, it's advised not to rip out this schema because if you do eventually need organization switching and shared multi-tenancy, it could be considerably more difficult to retrofit it than if you had designed around it from the start.
Managing users within organizations
Users with the admin role have the permission to invite new users to an organization. This can be done either via initial onboarding or via /members
page in the dashboard. A user who is invited to an organization can see their invitations either in the same initial onboarding, if any invitations exist, or via the organization switcher in the dashboard.
When a user switches organizations, it will change the users.defaultOrganizationId
value in database and all queries that depend on organization-specific content will use this value to determine what content to fetch.