Skip to content

[5578] fix(frontend): Restore the Remove action in the members row menu - #5584

Open
mmabrouk wants to merge 1 commit into
release/v0.106.1from
fix/member-remove-menu-gate
Open

[5578] fix(frontend): Restore the Remove action in the members row menu#5584
mmabrouk wants to merge 1 commit into
release/v0.106.1from
fix/member-remove-menu-gate

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

On EE deployments whose organization does not have the RBAC entitlement, the "Remove" action never appears in a workspace member row's "..." menu — the menu renders empty (returns null), so owners and admins cannot remove members or revoke pending invitations from the UI. This is also what makes the members.spec.ts pending-member removal test time out waiting for the menu.

Root cause

The row menu, including the Remove item and the menu's early return, was gated on canModifyRoles. That flag is hard-false for EE orgs without the RBAC entitlement. But member removal is not role modification: the backend gates DELETE /workspaces/{id}/users on being the org owner or having the owner/admin role (and allows all for non-entitled EE), so the frontend was strictly more restrictive than the API.

Fix

Add a canRemoveMembers gate in useWorkspacePermissions (hasRole("owner") || hasRole("admin"); hasRole already returns true for org owners and for editions where RBAC is not active), mirroring the backend's check. The Remove item and the menu's early return now use it. The other items keep their existing gates: resend invitation stays on canInviteMembers, role editing stays on canModifyRoles.

How to verify

  1. On an EE deployment without the RBAC entitlement, invite a member so a pending row exists in Settings > Workspace.
  2. Open the row's "..." menu: Remove now appears, and confirming the dialog removes the row.
  3. Accepted member rows behave the same way; role editing and resend invitation are unchanged.

Closes #5578

https://claude.ai/code/session_01Qitvc9dCiunLishsJYRzbp

…ion (#5578)

The members row menu returned null for non-RBAC-entitled EE orgs because
every item was gated on canModifyRoles, which is hard-false without the
RBAC entitlement. Member removal is not role modification: the backend
gates DELETE /workspaces/{id}/users on org owner or owner/admin role.
Add a canRemoveMembers gate mirroring that and use it for the Remove
item and the menu's early return.

Claude-Session: https://claude.ai/code/session_01Qitvc9dCiunLishsJYRzbp
@mmabrouk

Copy link
Copy Markdown
Member Author

@coderabbitai review

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 30, 2026
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Jul 30, 2026 2:39pm

Request Review

@dosubot dosubot Bot added Bug Report Something isn't working Frontend labels Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Updated workspace member management permissions so only workspace owners and admins can remove members.
    • Corrected the visibility of workspace action menus based on invitation and removal permissions.

Walkthrough

The workspace permissions hook now exposes role-based member removal access. The workspace member actions menu uses this permission to determine whether the menu renders and whether the “Remove” action is available.

Changes

Workspace member removal

Layer / File(s) Summary
Derive removal permission
web/oss/src/hooks/useWorkspacePermissions.ts
useWorkspacePermissions uses hasRole to expose canRemoveMembers for workspace owners and admins.
Apply removal permission
web/oss/src/components/pages/settings/WorkspaceManage/cellRenderers.tsx
The member actions menu uses canRemoveMembers for its rendering guard and “Remove” option.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: restoring the Remove action in the members row menu.
Description check ✅ Passed The description matches the changeset and explains the Remove-action permission fix.
Linked Issues check ✅ Passed The PR adds a separate remove-members permission and uses it for the menu item and early return, matching #5578.
Out of Scope Changes check ✅ Passed The changes are narrowly scoped to workspace member permissions and menu rendering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/member-remove-menu-gate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
web/oss/src/hooks/useWorkspacePermissions.ts (1)

35-50: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the new removal gate.

Cover an EE workspace without RBAC where owner/admin users can remove both pending invitations and accepted members, while other roles cannot. This guards the exact permission regression described by the PR objective.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 463efe07-d7f0-4076-b06f-0c9e1396ba92

📥 Commits

Reviewing files that changed from the base of the PR and between 9ac0c55 and 628c5b4.

📒 Files selected for processing (2)
  • web/oss/src/components/pages/settings/WorkspaceManage/cellRenderers.tsx
  • web/oss/src/hooks/useWorkspacePermissions.ts

@mmabrouk

Copy link
Copy Markdown
Member Author

fair point, but testing the hook directly means mocking the whole workspace + role state, so it's not a quick add. the flow itself is covered by the playwright acceptance test (members.spec.ts, "remove a pending member") which runs against the EE stage. that's actually the test that caught this regression in the first place. if this area bites again we'll add a colocated hook test as a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Report Something isn't working Frontend size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant