Skip to main content
Definable implements a comprehensive invitation system that allows organization administrators to invite users to join their organization with predefined roles and permissions.

Overview

The invitation system enables:
  1. Organization administrators to invite new users
  2. Assignment of specific roles during invitation
  3. Secure email-based verification
  4. Streamlined onboarding for new users

Invitation Lifecycle

Invitations follow a defined lifecycle managed through status transitions:
  • Pending: Initial state, awaiting response from invitee
  • Accepted: Invitee has accepted and joined the organization
  • Rejected: Invitee has explicitly declined the invitation
  • Expired: Time limit has passed without response
  • Revoked: Administrator has canceled the invitation

Creating Invitations

Organization administrators can invite users with a specified role:
Key aspects of invitation creation:
  • Each invitation is tied to a specific organization
  • A specific role is assigned
  • A secure random token is generated
  • Expiration time is set (default: 48 hours)
  • Email notifications are automatically sent

Email Notifications

The system sends personalized invitation emails:
These emails contain:
  • Organization details
  • Inviter’s name
  • Secure invitation link with token
  • Clear instructions for accepting or declining

Accepting Invitations

When a user follows the invitation link, the system:
  1. Validates the invitation token
  2. Checks if the invitation is still pending and not expired
  3. Verifies the email address matches
For new users, the system:
  1. Displays a signup form
  2. Creates a new user account
  3. Associates the user with the organization using the assigned role
For existing users, the system simply adds them to the organization with the assigned role.

Rejecting Invitations

Users can explicitly reject invitations by:
  • Following a β€œDecline” link in the email
  • Clicking a reject button in the application interface

Managing Pending Invitations

Organization administrators can view and manage pending invitations:
  • List all pending invitations
  • Resend invitations
  • Revoke invitations before they’re accepted
The invitation list provides:
  • Invitee email address
  • Timestamp of invitation
  • Current status
  • Expiration time

Invitation Token Security

The invitation system incorporates multiple security measures:
  • Unique Tokens: Each invitation has a cryptographically secure random token
  • Limited Validity: Tokens expire after a configurable time period
  • Single Use: Tokens become invalid after use
  • Email Verification: Token must be used with the invited email address
  • Organization Context: Each token is tied to a specific organization

Role Validation

The system enforces hierarchical role constraints:
This ensures that:
  • Users can only invite others with roles of lower privilege
  • Owners can invite admins, members, and guests
  • Admins can invite members and guests
  • Members can only invite guests (if allowed)

API Endpoints

The invitation flow is managed through these endpoints:

Request and Response Examples

Invitation UI Flow

The frontend implements a streamlined invitation flow:
  1. User receives email with invitation link
  2. User clicks link and is directed to the application
  3. System validates the invitation token
  4. New users complete a registration form
  5. Existing users are prompted to login
  6. User is redirected to the organization dashboard

Next Steps