2022-10-23
AccountsMulti tenancyTeamsInvitations

How to create additional accounts and invites

Out of the box, every user created in the system also gets a personal account. But let’s say that you want to create a resource that can be accessed by many users. In this post, I will show you how the teams, accounts, memberships and invitations all work together.

Accounts page

The accounts page gives the user an overvie of the accounts the user is a team member of and that includes the personal account. Since the personal account, is personal and another user can't join that team, the user has a possibility to setup a new account.

So, to create a new account, just click the new account-button and add the name of the company, team or organisation.

Note that when the account was created, the user was automatically added to that team.

Note the link Members on the right, that is the link to the members page. If the user clicks there, he or she ends up on the Account members page.

On this page, there is the option to invite an additional user by email. That user might or might not already be a member on the platform.

Adding a user makes it show up on the list as a pending invite. Here, is the option to cancel the invite.

What laso happens, is two things:

Email

There should be an email delivered that notifies the user of the invite. You can inspect the email if you go to http://localhost:4000/dev/mailbox

Invite is stored in the database

The invitation is stored in the invitations table in the database.

Before it is accepted or declined, the row looks like this:

Accepting an invite

Lets say that James, from the invite above receives the email and want to join the account. When he registers or sign ins, and goes to his accounts page, he should see his invite.Now he can accept or decline.

Accepting the invitation marks the invitation as accepted in the database and James is now part  of the team as a member.