Skip to content

Commit ee6fce8

Browse files
author
Lasim
committed
Enhance team management documentation: clarify multi-user support, member management permissions, and default team restrictions.
1 parent b3df754 commit ee6fce8

3 files changed

Lines changed: 241 additions & 13 deletions

File tree

docs/deploystack/development/backend/roles.mdx

Lines changed: 124 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,16 @@ The RBAC system provides fine-grained access control through roles and permissio
7474

7575
## Team System
7676

77-
DeployStack includes a comprehensive team management system that allows users to organize their work into teams. Each user automatically gets their own team upon registration and can create up to 3 teams total.
77+
DeployStack includes a comprehensive team management system that allows users to organize their work into teams and collaborate with other users. Each user automatically gets their own team upon registration and can create up to 3 teams total.
7878

7979
### Team Features
8080

8181
- **Automatic Team Creation**: Every new user gets a default team created with their username
8282
- **Team Ownership**: Each team has an owner who has full administrative control
83-
- **Single User Teams**: Currently, teams support only one user per team
83+
- **Multi-User Teams**: Teams support up to 3 members with role-based access control
8484
- **Team Limits**: Users can create up to 3 teams maximum
8585
- **Unique Slugs**: Teams have URL-friendly slugs with automatic conflict resolution
86+
- **Default Team Protection**: Default teams cannot have additional members added (personal workspace)
8687

8788
### Team Database Schema
8889

@@ -301,6 +302,95 @@ GET /api/teams/:id/members
301302
Authorization: Required (team.members.view permission)
302303
```
303304

305+
**Response:**
306+
307+
```json
308+
{
309+
"success": true,
310+
"data": [
311+
{
312+
"id": "membership123",
313+
"user_id": "user123",
314+
"username": "johndoe",
315+
"email": "john@example.com",
316+
"first_name": "John",
317+
"last_name": "Doe",
318+
"role": "team_admin",
319+
"is_admin": true,
320+
"is_owner": true,
321+
"joined_at": "2025-01-30T15:00:00.000Z"
322+
}
323+
]
324+
}
325+
```
326+
327+
#### Add Team Member
328+
329+
```http
330+
POST /api/teams/:id/members
331+
Authorization: Required (team.members.manage permission or global admin)
332+
Content-Type: application/json
333+
334+
{
335+
"userId": "user456",
336+
"role": "team_user"
337+
}
338+
```
339+
340+
**Restrictions:**
341+
- Maximum 3 members per team
342+
- Cannot add members to default teams (protected)
343+
- User must exist in the system
344+
- Team admin or global admin required
345+
346+
#### Update Team Member Role
347+
348+
```http
349+
PUT /api/teams/:id/members/:userId/role
350+
Authorization: Required (team.members.manage permission or global admin)
351+
Content-Type: application/json
352+
353+
{
354+
"role": "team_admin"
355+
}
356+
```
357+
358+
**Restrictions:**
359+
- Cannot change roles in default teams
360+
- Must maintain at least one team admin
361+
- Team admin or global admin required
362+
363+
#### Remove Team Member
364+
365+
```http
366+
DELETE /api/teams/:id/members/:userId
367+
Authorization: Required (team.members.manage permission or global admin)
368+
```
369+
370+
**Restrictions:**
371+
- Cannot remove from default teams
372+
- Cannot remove team owner (must transfer ownership first)
373+
- Cannot remove last member from team
374+
- Team admin or global admin required
375+
376+
#### Transfer Team Ownership
377+
378+
```http
379+
PUT /api/teams/:id/ownership
380+
Authorization: Required (team owner or global admin)
381+
Content-Type: application/json
382+
383+
{
384+
"newOwnerId": "user456"
385+
}
386+
```
387+
388+
**Restrictions:**
389+
- Cannot transfer ownership of default teams
390+
- New owner must be a team member
391+
- New owner automatically becomes team_admin
392+
- Only current owner or global admin can transfer
393+
304394
### Team Service Methods
305395

306396
The `TeamService` class provides comprehensive team management:
@@ -341,6 +431,38 @@ const isDefault = await TeamService.isDefaultTeam(teamId, userId);
341431

342432
// Get team membership details
343433
const membership = await TeamService.getTeamMembership(teamId, userId);
434+
435+
// ===== TEAM MEMBER MANAGEMENT METHODS =====
436+
437+
// Add team member
438+
const membership = await TeamService.addTeamMember(teamId, userId, 'team_user');
439+
440+
// Remove team member
441+
const removed = await TeamService.removeTeamMember(teamId, userId);
442+
443+
// Update member role
444+
const updatedMembership = await TeamService.updateMemberRole(teamId, userId, 'team_admin');
445+
446+
// Transfer team ownership
447+
const transferred = await TeamService.transferOwnership(teamId, newOwnerId);
448+
449+
// Get team members with user info
450+
const membersWithInfo = await TeamService.getTeamMembersWithUserInfo(teamId);
451+
452+
// Get user teams with role info
453+
const teamsWithRoles = await TeamService.getUserTeamsWithRoles(userId);
454+
455+
// Team capacity and permission checks
456+
const canAddMember = await TeamService.canAddMemberToTeam(teamId);
457+
const canRemoveMember = await TeamService.canRemoveMemberFromTeam(teamId, userId);
458+
const canManageMember = await TeamService.canUserManageTeamMember(teamId, managerId, targetUserId, 'add');
459+
460+
// Team member counts
461+
const memberCount = await TeamService.getTeamMemberCount(teamId);
462+
const adminCount = await TeamService.getTeamAdminCount(teamId);
463+
464+
// Default team protection checks
465+
const isTeamDefault = await TeamService.isTeamDefault(teamId);
344466
```
345467

346468
### Frontend Team Management

docs/deploystack/roles.mdx

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,37 @@ User roles determine what actions a person can perform in DeployStack. Think of
4545
**What they can do**:
4646
- Manage their team's settings
4747
- View team members
48+
- **Add new members to their teams** (up to 3 members total)
49+
- **Change member roles** (promote team_user to team_admin, or demote)
50+
- **Remove team members** (except team owners)
51+
- **Transfer team ownership** to another team member
4852
- Manage team deployments
49-
- Delete teams they own
53+
- Delete teams they own (except default teams)
54+
55+
**Important**: Team admins have full control over team membership and can manage all team members except the team owner.
56+
57+
## Team Member Management Permissions
58+
59+
The following table shows exactly what each role can do with team member management:
60+
61+
| Action | team_user | team_admin | team_admin + owner | global_admin |
62+
|--------|-----------|------------|-------------------|--------------|
63+
| List team members | ✅ (own teams) | ✅ (own teams) | ✅ (own teams) | ✅ (any team) |
64+
| Add team member || ✅ (non-default) | ✅ (non-default) | ✅ (any team) |
65+
| Remove team_user || ✅ (non-default) | ✅ (non-default) | ✅ (any team) |
66+
| Remove team_admin ||| ✅ (non-default) | ✅ (any team) |
67+
| Remove team owner |||| ✅ (any team) |
68+
| Promote to team_admin || ✅ (non-default) | ✅ (non-default) | ✅ (any team) |
69+
| Demote team_admin ||| ✅ (non-default) | ✅ (any team) |
70+
| Transfer ownership ||| ✅ (non-default) | ✅ (any team) |
71+
| Delete team ||| ✅ (non-default) | ✅ (non-default) |
72+
73+
**Key Notes:**
74+
- **Default teams** are completely protected - no member management operations allowed
75+
- **Team admins** can only manage team_users, not other team_admins or owners
76+
- **Team owners** have full control over their teams (except default teams)
77+
- **Global admins** can override most restrictions but still cannot modify default teams
78+
- **3-member limit** applies to all teams (owner + 2 additional members maximum)
5079

5180
### Team User
5281
**Who needs this**: Basic team members who participate in deployments.
@@ -56,6 +85,8 @@ User roles determine what actions a person can perform in DeployStack. Think of
5685
- See team members
5786
- Participate in team activities
5887

88+
**Limitations**: Team users cannot add members, change roles, or manage other team members.
89+
5990
## Understanding Teams
6091

6192
Teams are groups where users organize their deployment projects. Here's how teams work:

docs/deploystack/teams.mdx

Lines changed: 85 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ In DeployStack, teams provide:
1616
- **Resource Organization**: All your MCP servers, credentials, and settings are organized within teams
1717
- **Access Control**: Team-based permissions ensure secure access to your deployment resources
1818
- **Multi-Project Support**: Create up to 3 teams to organize different projects or environments
19+
- **Team Collaboration**: Teams support multiple members with role-based access control
20+
- **Default Team Protection**: Your personal default team cannot have additional members added
1921

2022
Every team acts as a complete deployment environment, containing everything needed to deploy and manage MCP servers across various cloud providers.
2123

@@ -135,22 +137,95 @@ The interface provides clear visual feedback:
135137

136138
### Current Structure
137139

138-
DeployStack teams currently operate with a **single-user model**:
140+
DeployStack teams support **multi-user collaboration** with role-based access control:
139141

140-
- Each team belongs to one user
141-
- You have full control over your teams
142-
- No team sharing or collaboration features (planned for future releases)
142+
- Teams can have up to **3 members maximum**
143+
- Each team has one **owner** who created the team
144+
- Team members can have different roles with specific permissions
145+
- **Default teams are personal** - no additional members can be added to your default team
143146

144147
### Team Roles
145148

146-
Within your teams, you automatically have the **Team Administrator** role, which provides:
149+
Teams support two distinct roles with different capabilities:
147150

148-
- Full access to all team resources
149-
- Ability to deploy and manage MCP servers
150-
- Permission to modify team settings
151-
- Authority to delete the team
151+
#### Team Administrator
152+
- **Full team management**: Can add/remove members, change roles, transfer ownership
153+
- **Resource access**: Full access to all team resources and deployments
154+
- **Team settings**: Can modify team name, description, and all configurations
155+
- **Member management**: Can promote team users to admins or demote admins to users
152156

153-
*Note: Team User roles exist in the system for future multi-user team functionality.*
157+
#### Team User
158+
- **Basic access**: Can view team information and see team members
159+
- **Limited permissions**: Cannot add members, change roles, or modify team settings
160+
- **Resource viewing**: Can see team resources but with restricted management capabilities
161+
162+
**Important**: Your **default team** (created automatically with your username) is protected - you cannot add other members to it. This keeps your personal workspace private.
163+
164+
## Team Member Management
165+
166+
### Adding Team Members
167+
168+
Team administrators can add new members to their teams (except default teams):
169+
170+
1. **Navigate to Team Management**: Go to your team's management page
171+
2. **Find Members Section**: Look for the team members management area
172+
3. **Add Member**: Click "Add Member" and enter the user's email or username
173+
4. **Assign Role**: Choose either "Team Administrator" or "Team User"
174+
5. **Send Invitation**: The user will be notified and added to the team
175+
176+
**Limitations**:
177+
- **Maximum 3 members** per team (including the owner)
178+
- **Default teams**: Cannot add members to your personal default team
179+
- **Existing users only**: Can only add users who already have DeployStack accounts
180+
181+
### Managing Member Roles
182+
183+
Team administrators and owners can change member roles:
184+
185+
#### Promoting Team Users to Administrators
186+
- **Who can do this**: Team administrators and team owners
187+
- **Process**: Select the member and change their role to "Team Administrator"
188+
- **Result**: User gains full team management capabilities
189+
190+
#### Demoting Team Administrators to Users
191+
- **Who can do this**: Team owners (and other team administrators)
192+
- **Restriction**: Must maintain at least one team administrator
193+
- **Process**: Change the administrator's role to "Team User"
194+
195+
### Removing Team Members
196+
197+
Team administrators can remove members from teams:
198+
199+
- **Who can remove**: Team administrators and owners
200+
- **Cannot remove**: Team owners (must transfer ownership first)
201+
- **Default teams**: No members to remove (single-user only)
202+
- **Process**: Select member and click "Remove from Team"
203+
204+
### Transferring Team Ownership
205+
206+
Team owners can transfer ownership to another team member:
207+
208+
1. **Requirement**: Target user must already be a team member
209+
2. **Process**: Go to team settings and select "Transfer Ownership"
210+
3. **Choose New Owner**: Select from existing team administrators
211+
4. **Confirm Transfer**: Confirm the ownership change
212+
5. **Result**: New owner gains full control, previous owner becomes team administrator
213+
214+
**Important**:
215+
- **Cannot transfer default team ownership** - default teams always belong to the original user
216+
- **Irreversible action** - ownership transfers cannot be undone
217+
- **New owner requirements** - Target user must be a team administrator
218+
219+
### Default Team Restrictions
220+
221+
Your automatically created default team has special protections:
222+
223+
- **No Additional Members**: Cannot add other users to your default team
224+
- **Cannot Transfer Ownership**: Default team ownership cannot be changed
225+
- **Cannot Leave**: You cannot leave your own default team
226+
- **Personal Workspace**: Designed to remain your private workspace
227+
228+
These restrictions ensure that every user always has a personal, private team for their individual work.
154229

155230
### Resource Isolation
156231

0 commit comments

Comments
 (0)