Repository navigation
Show every MCP role of a member on the roles and users pages - #1777
Closed
helpcodeai wants to merge 3 commits into
Closed
helpcodeai wants to merge 3 commits into
helpcodeai wants to merge 3 commits into
Conversation
Access is the union of all role assignments, but the roles pages showed and edited only the deprecated single users.mcpRoleId, so a role granted by a single sign-on group stayed invisible. Add GET /api/roles/members with all assignments and the connectors they reach, edit manual roles through PUT /api/roles/assignments/:userId, mark synced and all-workspace roles read-only, and return mcpRoles from GET /api/users.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A member can hold several MCP roles: ones an admin set by hand, ones that come from a single sign-on group sync, and grants with no workspace that apply everywhere. They can use the tools of all of them combined (
RolesService.getAllowedToolIds). But Settings → Roles and the older admin roles page only showed and edited the deprecated singleusers.mcpRoleId, through the deprecatedPUT /api/roles/assign/:userId. So an admin could pick role X, see X on the page, and the member still reached more connectors through a synced role nobody could see. The users pages had the same problem in their read-only "MCP role" column.Changes
GET /api/roles/members(ADMIN): every member of the active workspace with all their role assignments{ roleId, roleName, source, global }, plusconnectors, the connectors their roles reach.connectorsisnullwhen roles don't limit the member (an ADMIN, or no role while the workspace has no tool list) and[]when they reach nothing. Every query is filtered byorganizationId. Grants with no workspace are included, using the same scope asgetAllowedToolIds.GET /api/roles/assignments/:userIdnow returns 404 for a user who isn't a member. Before, it would show that user's workspace-independent grants to any admin.GET /api/usersalso returnsmcpRoles(all assignments, same shape). The Swagger docs now markmcpRoleId/mcpRoleas deprecated.GET /api/rolesdescription: it said a member with no role always reaches every tool, which stopped being true once a workspace has a tool list.MemberRoleAssignmentstable, used by both/settings/rolesand/admin/roles. For each member who isn't an admin it shows every role as a chip. Manual roles are edited with a multi-select that callsPUT /api/roles/assignments/:userId, which replaces only manual roles. Synced roles are read-only and labelled "from single sign-on group", with a link to Settings → Single sign-on → Role mappings. Roles that apply in every workspace are labelled "all workspaces" and are also read-only. A new column shows how many connectors the member's roles reach./settings/users,/admin/users) show all role chips instead of the single deprecated role.roles.assignToUser(the deprecated endpoint) is removed fromlib/api.ts. The backend endpoint stays for old clients.settingsRoles.assign.noRestrictionis removed.docs/api-reference.md(role assignment endpoints and sources; also fixes an existing error: it said the rate-limit editor UI did not exist yet, but it does),docs/operations/member-visibility.md(step 3 said to assign roles under Settings → Users, but they are assigned under Settings → Roles),docs/sso.md.Cloud and self-hosted behave the same; nothing here depends on the deployment mode. No schema change.
Type
Testing
roles.service.spec.ts:getMemberAssignments,getUserRolesmembership check;users.service.spec.ts:mcpRoles)tests/e2e/role-assignments.spec.ts. Not run locally because no dev server is allowed on the shared machine. CI runs it.Commands, with actual results:
packages/backend:npx jest src/roles/roles.service.spec.ts src/users/users.service.spec.ts --maxWorkers=2→ 2 suites, 82 tests passedpackages/backend:npm run lint→ 0 errors, 11 warnings that were already there (none in new code). eslint--fixchanged no files.packages/backend:npx tsc --noEmit -p tsconfig.json→ exit 0packages/frontend:npm run lint→ 0 errors, 51 warnings. The ones in the touched files are the existingset-state-in-effect/exhaustive-depspattern of these pages.packages/frontend:npx tsc --noEmit -p tsconfig.json→ exit 0Checklist
Related Issues
None filed.