Description of the Bug
In backend/app/routes/workspaces.py, the invite_workspace endpoint uses get_admin_user as a dependency:
admin_user: User = Depends(get_admin_user)
get_admin_user checks for UserRole.admin, which is a site-level global admin role. However, workspace invitations should be available to workspace-level administrators (users who have WorkspaceRole.admin in that specific workspace).
This means:
- Only global site administrators can send workspace invitations
- Workspace creators and workspace admins cannot invite new members
- The workspace collaboration feature is effectively broken unless the user is a site admin
- This defeats the entire purpose of workspace-level role management
Steps to Reproduce
- Register as a regular user (not a site admin)
- Create a workspace (you become the workspace owner)
- Try to invite another user to the workspace via the invite endpoint
- The request fails with a 403 Unauthorized error because you are not a site-level admin
Expected Behavior
The invite endpoint should:
- Accept any authenticated user
- Verify that the user has
WorkspaceRole.admin or WorkspaceRole.owner for the specific workspace
- Only then allow sending invitations
Affected File
backend/app/routes/workspaces.py (line ~79)
Suggested Fix
Change the dependency from get_admin_user to get_current_user, then validate workspace admin permissions within the endpoint:
@router.post("/{workspace_id}/invite")
def invite_workspace(
workspace_id: str,
payload: InviteRequest,
current_user: User = Depends(get_current_user),
db: Session = Depends(get_db_session),
):
# Check workspace membership and admin role
membership = db.query(WorkspaceMember).filter(
WorkspaceMember.workspace_id == workspace_id,
WorkspaceMember.user_id == current_user.id,
WorkspaceMember.role.in_([WorkspaceRole.admin, WorkspaceRole.owner])
).first()
if not membership:
raise ForbiddenException("Only workspace admins can send invitations")
GSSoC '26
Description of the Bug
In
backend/app/routes/workspaces.py, theinvite_workspaceendpoint usesget_admin_useras a dependency:get_admin_userchecks forUserRole.admin, which is a site-level global admin role. However, workspace invitations should be available to workspace-level administrators (users who haveWorkspaceRole.adminin that specific workspace).This means:
Steps to Reproduce
Expected Behavior
The invite endpoint should:
WorkspaceRole.adminorWorkspaceRole.ownerfor the specific workspaceAffected File
backend/app/routes/workspaces.py(line ~79)Suggested Fix
Change the dependency from
get_admin_usertoget_current_user, then validate workspace admin permissions within the endpoint:GSSoC '26