User Management
Our user model consists of 4 objects: - Organization - User - Token - Project
Organization and User are top level objects. A User can be a member of zero or more Organizations, though there isn't anything interesting to do until you are a member of at least one. Tokens are tied to a particular User. All other resources conceptually belong to an Organization, there is no cross Organization sharing.
When a User is added to an Organization, a default Project is created. This project is always used unless a specific Project is supplied as part of the request. In order to share resources, a new Project should be created and the Users should be added to it.
Additionally, if this is the users only organization, it is set as the default
organization for the user. If an organization is the default organization it
doesn't need to set the Organization in the request. Otherwise it must
specify the desired organization with the X-Organization-ID header.
Initialization
If the database is empty on poc2 startup, it will be initialized with some base objects required to use it. This involves:
- Creating a
internalOrganization. - Creating a
info@example.comuser. - Creating a token for this user in this organization.