Skip to end of banner
Go to start of banner

Invite a new user to join a team

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 53 Next »

Use cases

Background

Alice is a researcher at a lab and she is in the process of starting a new project. She is trying to recruit people to join her research team to work on her new project. Alice thinks that her friend Bob who is a researcher at a different lab might be interested in joining her team.

Use case A - Alice wants to invite Bob to join her Synapse team.

GoalAlice wants to invite Bob to join her Synapse team.
Primary actorAlice
Secondary actorBob
PreconditionAlice has created a team and she is at her team's page.
PostconditionBob receives an email invitation to join Alice's team.

Workflow

Main success scenario

Step 1. Alice invites Bob to join her team by entering his email address and an optional invitation message.

Step 2. System sends Bob an email containing an invitation link to join Alice's team.

Error scenarios

Replacing step 2.

    1. The email address entered by Alice doesn't exist.
    2. System sends an email to Alice to notify her of the problem.
    3. Alice tries again with a different email address.

Mockups

Use case B - Alice wants to invalidate the invitation she sent previously.

Goal

Alice wants to invalidate the invitation she sent previously.

Primary actorAlice
Secondary actorBob
Preconditions
  1. Alice has sent an email invitation to Bob.
  2. Bob hasn't accepted the email invitation yet.
PostconditionThe invitation link Bob received is no longer valid.

Workflow

Main success scenario

Step 1. Alice retrieves the pending invitations to her team and removes the one associated with Bob.

Step 2. System invalidates the invitation link sent to Bob.

Mockups

Use case C - Bob wants to create a Synapse account and accept Alice's invitation.

Goal

Bob wants to create a Synapse account and accept Alice's invitation.

Primary actor

Bob

Secondary actorAlice
Preconditions
  1. Alice has sent an email invitation to Bob.
  2. Bob doesn't have a Synapse account.
PostconditionBob is part of Alice's team.

Workflow

Main success scenario

Step 1. Bob clicks on the invitation link in the email he received and is directed to the Synapse web client.

Step 2. The web client presents Bob with the option to create a Synapse account or sign in with an existing account.

Step 3. Bob creates his new Synapse account.

Step 4. The web client displays Alice's invitation to Bob.

Step 5. Bob accepts Alice's team invitation.

Step 6. System sends a notification email to Alice saying that Bob has joined her team.

Mockups

Use case D - Bob wants to sign in to his existing Synapse account and accept Alice's invitation.

Goal

Bob wants to sign in to his existing Synapse account and accept Alice's invitation.

Primary actor

Bob

Secondary actorAlice
Preconditions
  1. Alice has sent an email invitation to Bob.
  2. Bob has one or more Synapse accounts.
PostconditionBob is part of Alice's team.

Workflow

Main success scenario

Step 1. Bob clicks on the invitation link in the email he received and is directed to the Synapse web client.

Step 2. The web client presents Bob with the option to create a Synapse account or sign in with an existing account.

Step 3. Bob signs in with his existing Synapse account.

Step 4. The web client displays Alice's invitation to Bob.

Step 5. Bob accepts Alice's team invitation.

Step 6. System sends a notification email to Alice saying that Bob has joined her team.

Mockups

Use case E - Bob wants to create a new Synapse account but doesn't want to accept Alice's invitation yet.

Goal

Bob wants to create a new Synapse account but doesn't want to accept Alice's invitation

Primary actor

Bob

Secondary actorAlice
Precondition
  1. Alice has sent an email invitation to Bob.
  2. Bob doesn't have a Synapse account.
PostconditionBob has a Synapse account with a pending invitation to join Alice's team.

Workflow

Main success scenario

Step 1. Bob clicks on the invitation link in the email he received and is directed to the Synapse web client.

Step 2. The web client presents Bob with the option to create a Synapse account or sign in with an existing account.

Step 3. Bob creates his new Synapse account.

Step 4. The web client displays Alice's invitation to Bob.

Mockups

Flow Diagram

Discussion about the rationale behind some design decisions

We always want to allow Bob to choose the account he joins Alice's team with. This led to the following design decisions:

  • In earlier versions of the design, if the email entered by Alice was already associated with an existing Synapse account, a membership invitation to that account would be created instead of sending an email invitation. The current design changes this behavior and instead, the system always sends an email invitation to Bob and the membership invitation to the Synapse account isn't created.
  • Even if Bob is already signed in to Synapse in his browser, clicking on the invitation link should always ask Bob to sign in again. This avoids the case where Bob accidentally joins the team with the account with which he is currently signed in.

Bob should not be automatically added to the team after registering a new account / signing in to his account, but instead he should need to manually accept the membership invitation. This separates the process of registering for a Synapse account and joining the team, giving Bob the chance to explore Synapse without committing to join Alice's team.

Proposal

Use cases to support

I propose to support all the use cases except use case B. After multiple discussions about the necessity of use case B, I have come to the conclusion that it's an edge case that would incur significant development cost for little benefit. Supporting it would require our system to keep track of the invitation sent by Alice in some form, which is a requirement that none of the other use cases impose on us.

Models to implement

EmailInvitationMembershipInvtnSignedToken

emailAddress

teamId


emailAddress

inviteeId

inviterId

teamId

hmac

Related models: AccountSetupInfoMembershipInvtnSubmission

Services to implement

ActionIntended UserURIMethodRequest ParametersRequest BodyResponse BodySuccess Response CodeNotification Sent to Notes
Send email invitation with link to join a teamauthorized user/emailInvitationPOST
EmailInvitation
200 OKEmail address providedThe invitation link will contain a serialized MembershipInvtnSignedToken with inviteeId set to null
Create MembershipInvitation using a signed tokenpublic/tokenMembershipInvitation POST
MembershipInvtnSignedTokenMembershipInvtnSubmission201 Created
Similar to POST /membershipInvitation, but using a signed token for authorization. Also, doesn't send any email notifications.

Related services: POST /principal/availablePOST /accountPOST /sessionPOST /membershipInvitation

Example implementation with Synapse web client

As the use cases above, the inviter is Alice and the invitee is Bob.

  1. Alice invites Bob to her team by entering his email address.
  2. Web client constructs an EmailInvitation using Bob's email address and Alice's team's id, then uses it to send a POST /emailInvitation request to the backend.
  3. Backend constructs a signed MembershipInvtnSignedToken with Bob's email address, Alice's team's id, Alice's id and a null inviteeId (because we don't know Bob's account's id yet).
  4. Backend serializes the MembershipInvtnSignedToken, embeds it into an invitation link to the web client and sends the link to Bob's email address.
  5. Bob clicks on the link and does one of the following:
    1. Registers a new Synapse account. [1]
      1. Web client checks that Bob's email address is a valid account alias through POST /principal/available.
      2. Web client constructs an AccountSetupInfo [2], then uses it to create Bob's account through POST /account and receives a session token.
    2. Signs in to his existing Synapse account.
      1. Web client retrieves a session token through POST /session.
  6. Web client deserializes and validates the MembershipInvtnSignedToken in the link, then sets the inviteeId to the id of the account Bob used (extracted from the session token).
  7. Web client re-signs the MembershipInvtnSignedToken, then uses it to send a POST /tokenMembershipInvitation request to the backend.
  8. Backend validates the MembershipInvtnSignedToken and uses it to create a MembershipInvitation from Alice's team to Bob's account.
  9. Web client receives backend's 201 response, then directs Bob to his profile's Team tab, where he has a pending MembershipInvitation to Alice's team
  10. Bob accepts Alice's invitation (using the existing MembershipInvitation services).

[1] Note that this process is a bit different from the normal registration workflow because we are avoiding to have to validate Bob's email address. It'd be nonsensical to ask Bob to validate his email address because he reached this state by clicking a link sent to that very email address. Also note that this workflow only allows Bob to register the email address to which the invitation link was sent.

[2] Note that the web client needs to construct a valid emailValidationToken, making up a timestamp in the process.

Alternative implementations


DescriptionProsCons
1

POST /emailInvitation and POST /tokenMembershipInvitation

(Proposal described above)

+ Supports most use cases (all but B)

+ Simple -> less development time

- Not RESTful
2

Same as option 1, but store EmailInvitation in the database and implement REST methods for it.

I.e. GET /emailInvitation, GET /emailInvitation/{id}, DELETE /emailInvitation/{id}, etc.

+ Supports use case B

+ RESTful

- More complex -> more development time
3

User precursor

+ Supports use case B

+ More easily extensible (future support for operations other than inviting to a team)

+ RESTful

- Even more complex -> more development time

- ACL management is out of scope

  • No labels