Team Collaboration
Team Collaboration Use Cases
This document describes real-world scenarios for team collaboration in Global Watch, including team creation, member management, invitations, and role assignments.
UC-101: Create Team Account
Description
User creates a new team account (workspace) for collaborative forest monitoring. The system creates the account, assigns ownership, and sets up default roles.
Actors
- Primary: Authenticated User
- Secondary: Onboarding System
Preconditions
- User is authenticated
- User has completed personal account setup
- Team accounts feature is enabled
Postconditions
- Team account created with unique slug
- User assigned as team owner
- Default roles configured
- Team workspace accessible via subdomain
Main Flow
- User navigates to team creation
- User enters team details:
- Name: "Acme Corporation"
- Slug: Auto-generated as
acme-corporation
- System validates slug uniqueness
- System creates team account
- System assigns user as owner
- System creates default roles (owner, admin, member)
- User is redirected to team dashboard
- Team accessible at
acme-corporation.global.watch
Alternative Flows
A1: Slug Already Exists
- User enters team name
- Auto-generated slug conflicts with existing team
- System shows error: "This team URL is already taken"
- User manually edits slug
- Continue from step 3 of main flow
A2: Reserved Slug
- User enters team name that generates reserved slug
- System shows error: "This team name is reserved"
- User chooses different name
- Continue from step 2 of main flow
Business Rules
| ID | Rule |
|---|---|
| BR-TM-001 | Team slug must be unique globally |
| BR-TM-002 | Reserved slugs: app, www, api, admin, auth, cdn, etc. |
| BR-TM-003 | Team creator becomes owner automatically |
| BR-TM-004 | Default roles created on team creation |
Reserved Slugs
The following slugs cannot be used for team accounts:
app, www, api, admin, auth, cdn, assets, asset, static,
docs, blog, help, support, status, mail, ftp, workspace,
map, maps, report, reportsUC-102: Invite Team Member
Description
Team owner or admin invites a new user to join the team. The system sends an invitation email and creates a pending invitation record.
Actors
- Primary: Team Owner/Admin
- Secondary: Email System, Invited User
Preconditions
- User is authenticated
- User has
invites.managepermission - Team has available member slots (if limited)
Postconditions
- Invitation record created
- Invitation email sent
- Invitation expires after 7 days
Main Flow
- Admin navigates to team members page
- Admin clicks "Invite Member"
- Admin enters invitation details:
- Email:
alice@example.com - Role: Member (or Admin)
- Email:
- System validates email format
- System checks if user already a member
- System creates invitation record
- System sends invitation email
- Admin sees success message
- Invitation appears in pending list
Alternative Flows
A1: User Already Member
- Admin enters email of existing member
- System shows error: "User is already a team member"
- Use case ends
A2: Invalid Email
- Admin enters invalid email format
- System shows validation error
- Admin corrects email
- Continue from step 4 of main flow
A3: Role Hierarchy Violation
- Admin tries to invite user with higher role
- System shows error: "Cannot invite with role higher than your own"
- Admin selects appropriate role
- Continue from step 4 of main flow
Business Rules
| ID | Rule |
|---|---|
| BR-TM-005 | Only users with invites.manage can invite |
| BR-TM-006 | Cannot invite with role higher than inviter's role |
| BR-TM-007 | Invitations expire after 7 days |
| BR-TM-008 | Duplicate invitations update existing record |
Invitation Email
Subject: You've been invited to join [Team Name] on Global Watch
Hi,
[Inviter Name] has invited you to join [Team Name] on Global Watch.
Click the link below to accept the invitation:
[Accept Invitation Button]
This invitation expires in 7 days.
If you didn't expect this invitation, you can ignore this email.
Best,
The Global Watch TeamUC-103: Accept Invitation
Description
User accepts a team invitation and joins the team with the assigned role.
Actors
- Primary: Invited User
- Secondary: Team Account
Preconditions
- Valid invitation exists
- Invitation has not expired
- User is authenticated (or will authenticate)
Postconditions
- User added as team member
- Invitation marked as accepted
- User can access team workspace
Main Flow
- User clicks invitation link in email
- System validates invitation token
- If user not authenticated:
- User signs in or creates account
- System displays invitation details:
- Team name
- Inviter name
- Assigned role
- User clicks "Accept Invitation"
- System creates membership record
- System marks invitation as accepted
- User is redirected to team dashboard
Alternative Flows
A1: Invitation Expired
- User clicks invitation link
- System detects invitation expired
- System shows error: "This invitation has expired"
- System suggests contacting team admin
- Use case ends
A2: Invitation Already Accepted
- User clicks invitation link
- System detects invitation already accepted
- System redirects to team dashboard
- Use case ends
A3: User Already Member
- User clicks invitation link
- System detects user is already a member
- System shows message: "You're already a member of this team"
- System redirects to team dashboard
- Use case ends
Business Rules
| ID | Rule |
|---|---|
| BR-TM-009 | Invitation token is single-use |
| BR-TM-010 | User must authenticate to accept |
| BR-TM-011 | Accepting creates membership immediately |
UC-104: Update Member Role
Description
Team admin changes a member's role within the team.
Actors
- Primary: Team Owner/Admin
- Secondary: Target Member
Preconditions
- User is authenticated
- User has
roles.managepermission - Target member exists
- Target member has lower role hierarchy
Postconditions
- Member role updated
- Permissions updated accordingly
- Audit log entry created
Main Flow
- Admin navigates to team members page
- Admin locates target member
- Admin clicks "Change Role"
- Admin selects new role from dropdown
- System validates role change is allowed
- System updates member role
- System logs change to audit log
- Admin sees success message
- Member's permissions updated immediately
Alternative Flows
A1: Cannot Modify Higher Role
- Admin attempts to change role of owner
- System shows error: "Cannot modify users with equal or higher role"
- Use case ends
A2: Cannot Promote Above Own Role
- Admin attempts to promote member to owner
- System shows error: "Cannot assign role higher than your own"
- Admin selects appropriate role
- Continue from step 5 of main flow
Business Rules
| ID | Rule |
|---|---|
| BR-TM-012 | Can only modify users with lower role hierarchy |
| BR-TM-013 | Cannot promote above own role level |
| BR-TM-014 | Role changes take effect immediately |
| BR-TM-015 | Primary owner role cannot be changed |
Role Hierarchy
owner (hierarchy_level: 1) ← Highest privilege
↓
admin (hierarchy_level: 2)
↓
manager (hierarchy_level: 3)
↓
member (hierarchy_level: 4) ← Lowest privilegeUC-105: Remove Team Member
Description
Team admin removes a member from the team.
Actors
- Primary: Team Owner/Admin
- Secondary: Target Member
Preconditions
- User is authenticated
- User has
members.managepermission - Target member exists
- Target member is not the primary owner
Postconditions
- Member removed from team
- Member loses access to team resources
- Audit log entry created
Main Flow
- Admin navigates to team members page
- Admin locates target member
- Admin clicks "Remove Member"
- System shows confirmation dialog:
- "Remove [Name] from [Team]?"
- "They will lose access to all team resources."
- Admin confirms removal
- System deletes membership record
- System logs removal to audit log
- Admin sees success message
- Member can no longer access team
Alternative Flows
A1: Cannot Remove Owner
- Admin attempts to remove primary owner
- System shows error: "Cannot remove the team owner"
- Use case ends
A2: Cannot Remove Self
- Admin attempts to remove themselves
- System shows error: "Cannot remove yourself from the team"
- Use case ends
A3: Cannot Remove Higher Role
- Admin attempts to remove user with higher role
- System shows error: "Cannot remove users with equal or higher role"
- Use case ends
Business Rules
| ID | Rule |
|---|---|
| BR-TM-016 | Cannot remove primary account owner |
| BR-TM-017 | Cannot remove users with equal or higher role |
| BR-TM-018 | Removal is immediate and permanent |
| BR-TM-019 | Removed users can be re-invited |
UC-106: Transfer Team Ownership
Description
Team owner transfers ownership to another team member.
Actors
- Primary: Current Team Owner
- Secondary: New Owner
Preconditions
- User is the primary team owner
- Target user is a team member
- OTP verification enabled
Postconditions
- Ownership transferred to new user
- Previous owner becomes admin
- Audit log entry created
Main Flow
- Owner navigates to team settings
- Owner clicks "Transfer Ownership"
- Owner selects new owner from member list
- System shows confirmation with warnings:
- "This action cannot be undone"
- "You will become an admin"
- Owner enters OTP code for verification
- System validates OTP
- System transfers ownership
- System demotes previous owner to admin
- System logs transfer to audit log
- Both users notified of change
Alternative Flows
A1: Invalid OTP
- Owner enters incorrect OTP
- System shows error: "Invalid verification code"
- Owner retries or cancels
- After 3 failures, use case ends
A2: Target Not a Member
- Owner selects user not in team
- System shows error: "User must be a team member"
- Use case ends
Business Rules
| ID | Rule |
|---|---|
| BR-TM-020 | Only primary owner can transfer ownership |
| BR-TM-021 | OTP verification required for transfer |
| BR-TM-022 | Previous owner becomes admin after transfer |
| BR-TM-023 | Transfer is atomic (all or nothing) |
UC-107: Onboarding Flow
Description
New user completes onboarding to set up personal and team accounts.
Actors
- Primary: New User
- Secondary: Onboarding System
Preconditions
- User has verified email
- User has not completed onboarding
Postconditions
- Personal account created
- Team account created (optional)
- User redirected to main app
Main Flow
- User completes email verification
- System redirects to onboarding
- Step 1: Profile Setup
- User enters name: "John Doe"
- Live preview:
app.global.watch/john-doe - User clicks "Next"
- System creates personal account
- Step 2: Team Setup
- User enters team name: "Acme Corporation"
- Live preview:
acme-corporation.global.watch - User clicks "Complete"
- System creates team account
- System assigns user as team owner
- System creates membership record
- User redirected to main dashboard
Alternative Flows
A1: Skip Team Creation
- User completes Step 1
- User clicks "Skip" on Step 2
- Only personal account created
- User can create team later
A2: Personal Account Creation Fails
- User completes Step 1
- System fails to create personal account
- System shows error: "Could not create personal account"
- User can retry with different name
A3: Team Account Creation Fails
- User completes Step 1 (personal account created)
- User completes Step 2
- System fails to create team account
- System shows error: "Could not create team workspace"
- Personal account preserved
- User can retry team creation
Business Rules
| ID | Rule |
|---|---|
| BR-TM-024 | Personal account ID equals user ID |
| BR-TM-025 | Team creation is optional |
| BR-TM-026 | Onboarding must complete before app access |
Database State After Onboarding
-- auth.users
id: "123e4567-e89b-12d3-a456-426614174000"
email: "john.doe@example.com"
-- accounts (personal)
id: "123e4567-e89b-12d3-a456-426614174000" -- Same as user_id
name: "John Doe"
slug: "john-doe"
is_personal_account: true
-- accounts (team)
id: "987fcdeb-51a2-43f1-b456-426614174999"
name: "Acme Corporation"
slug: "acme-corporation"
is_personal_account: false
-- memberships
account_id: "987fcdeb-51a2-43f1-b456-426614174999"
user_id: "123e4567-e89b-12d3-a456-426614174000"
account_role: "owner"Testing Checklist
Team Creation
- Team created with unique slug
- Reserved slugs rejected
- Owner assigned automatically
- Default roles created
- Subdomain accessible
Invitations
- Invitation email sent
- Token validation works
- Expiration enforced (7 days)
- Duplicate invitations handled
- Role hierarchy respected
Member Management
- Role changes work correctly
- Cannot modify higher roles
- Cannot remove owner
- Audit log entries created
- Permissions update immediately
Onboarding
- Personal account created
- Team account created (optional)
- Membership assigned correctly
- Rollback on failure
- Skip team option works