feat(frontend): org member role dropdown + roles/access chart - #13604
feat(frontend): org member role dropdown + roles/access chart#13604ntindle wants to merge 4 commits into
Conversation
…2474) Replace the per-member Admin/Billing switches (and the invite form's Admin switch) with a single role dropdown that maps to the two backend flags (is_admin, is_billing_manager). Admin and billing are disjoint capabilities in the enforced permission matrix, so all four combinations are surfaced as roles: Member, Billing manager, Admin, Admin & billing. The org owner is not selectable and renders a static Owner badge. Adds a pure roleAccess.ts constants file (role -> flags + human-readable capabilities derived from _ORG_PERMISSIONS) surfaced via an info tooltip on the dropdown, and a shared OrgRoleSelect component used by both the members roster and the invite form. Co-Authored-By: Claude Opus <noreply@anthropic.com>
|
/batch |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## recut/tabs #13604 +/- ##
==============================================
+ Coverage 76.13% 76.15% +0.01%
==============================================
Files 2731 2733 +2
Lines 202160 202181 +21
Branches 19655 19659 +4
==============================================
+ Hits 153912 153962 +50
+ Misses 43968 43940 -28
+ Partials 4280 4279 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Screenshots or preview please 📸 🙏🏽 |
|
/batch orgs |
…-dropdown Clean forward-merge (inherits OrgTeamProvider resolution). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NBwmh7CkHiF8vKLBf2GWTU
…useAuth (keep branch's test additions) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NBwmh7CkHiF8vKLBf2GWTU
Why
SECRT-2474 (org walkthrough feedback, item 3): org member management surfaces two independent switches — Admin and Billing — and testers found the pairing confusing. Product direction: one role dropdown per member, extensible to more roles later, plus a first roles→access chart so it's discoverable what each role actually grants.
What
OrgRoleSelect(shared component): design-system Select with an info tooltip listing the selected role's capabilities. Used in member rows and the invite form.is_admin,is_billing_manager): Member, Billing manager, Admin, Admin & billing. All four combinations are real because admin and billing are disjoint in the enforced matrix (MANAGE_BILLING= owner + billing_manager only — admins don't get it). Owner renders as a static badge, never editable.roleAccess.ts): pure constants deriving each role's capability list directly from_ORG_PERMISSIONSinautogpt_libs/auth/permissions.py, surfaced in the tooltip.How
Stacked on the org-UI fleet (base:
recut/tabs). Uses the existing generated hooks (usePatchV2UpdateMemberRole,usePostV2CreateInvitation) — no backend changes.Testing
6 scenario tests added/updated in the org settings page suite (role rendering for every flag pair, both-flag PATCH payloads, Owner badge lock, read-only badge for non-admins, invite payload). 51 pass in the touched suites; format/lint/types clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Jm3mCG9okfdGtAXtFaDF9A
Note
Medium Risk
Changes how org admin and billing flags are set in the UI (atomic dual-flag PATCHs); incorrect mapping could grant or revoke billing/admin access, though existing API hooks are unchanged.
Overview
Org member and invite role UX is consolidated from a member/admin select plus a separate billing switch into a single
OrgRoleSelect(Member, Billing manager, Admin, Admin & billing), backed by newroleAccesshelpers that map each role to both backend flags and capability text for an info tooltip.Members show the dropdown only when an admin can manage the row; owners keep a static Owner badge; non-admins see read-only role badges. Role updates now send
roleToFlagsin one PATCH instead of toggling billing independently.Invitations use the same role picker (default Member), send
is_admin/is_billing_manageron create, and show non-member roles on pending rows viaroleLabel.Tests in the org settings page suite were expanded for every flag pair, atomic PATCH payloads, invite payloads, and read-only/owner behavior.
Reviewed by Cursor Bugbot for commit 8718b3c. Bugbot is set up for automated code reviews on this repo. Configure here.