Repository navigation
fix(users): permission overview shows admin:* grants and verb variants - #1610
Conversation
The Permission Overview matched group permissions exactly against a hardcoded view/create/update/delete/execute/approve/admin list. The Administrators group (admin:*) therefore showed "—" for everything but admin, and groups holding approve-any, retry-any or cancel-own looked like they held nothing for those verbs. Rows now come from the action vocabulary in permissions.ts (ALL_ACTIONS, plus any unknown action a group stores), with -own/-any variants under their base verb and admin last. A group holding admin:* shows every action as granted "via admin" (grey tick, title and sr-only text say so), except the verbs carved out of the wildcard (ADMIN_CARVED_OUTS, now exported), which are marked * with the exceptions in the tooltip unless the group grants them explicitly. A note under the table explains the grey ticks. New jest suite: permission-matrix.test.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adapted for standalone: the rules were appended at the end of settings.css, where the other admin sweep PRs also append. Move them under the existing .permission-matrix rules so this PR merges without conflicts in any order. No style change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 minutes. View limit details
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 |
|
Merge gate record (burndown orchestrator) Independent adversarial review (claude-opus-5-5)
Local verification
Screenshots (1440x900 and 390x844) are kept with the local run evidence; not attached here. |
This is a bug fix. The Permission Overview on Admin > Users, roles & API keys under-reported what groups can do. It matched each group's permissions exactly against a hardcoded list of seven verbs (view, create, update, delete, execute, approve, admin). So the Administrators group, which holds
admin:*, showed "—" for every row exceptadmin. Groups holding verb variants such asapprove-any,retry-anyorcancel-ownlooked as if they held nothing for those verbs, because the variants had no row. This PR builds the rows from the real action vocabulary and shows whatadmin:*grants, including the verbs the backend carves out of it.Part of the UI modernization sweep.
What changed
frontend/src/users/permissionMatrix.ts:ALL_ACTIONSinpermissions.ts, plus any action a group stores that the vocabulary lacks, so a granted permission is never hidden.-own/-anyvariants sort under their base verb, andadmincomes last.permissionMatrixActions(groups)andpermissionMatrixCell(group, action). A cell isdirect(the group grants the action; the tooltip lists the resources),admin(granted throughadmin:*) ornone.admin:*shows every action as a grey tick with "Granted via admin" in its title and sr-only text. The exception is the verbs carved out of the wildcard: their tick carries a*, and the tooltip names the exceptions ("Via admin:*, except execute:purchases, execute:ri-exchange (needs an explicit grant)"). A direct grant always wins over the admin tick.adminon a single resource is not treated as the wildcard.admin:*; otherwise it says to hover a tick for its resources.frontend/src/permissions.ts:ADMIN_CARVED_OUTSis exported (it was module-private). The value is unchanged.frontend/src/styles/settings.css: grey, regular-weight style for via-admin ticks, the small*mark and the note. The rules sit with the existing.permission-matrixrules (second commit moves them there from the end of the file so the admin PRs don't conflict; no style change).frontend/src/__tests__/permission-matrix.test.ts(new, 6 tests): rows cover the whole vocabulary in order; an unknown stored action gets a row; variants map to their own rows;admin:*grants everything via admin except the carved-out verbs; admin on one resource is not the wildcard; an explicit grant beats the wildcard.Why
The overview is there to answer "who can do what", and it answered wrongly for the most privileged group and for every variant verb.
The
*is there becauseadmin:*does not cover everything. The backend'sadminCarvedOuts(internal/auth/types.go, mirrored in the frontend asADMIN_CARVED_OUTS) removes four permissions from the wildcard:execute:purchases,approve-any:purchasesandretry-any:purchases(separation of duties for spending money, issue #923) andexecute:ri-exchange(issue #1644).HasPermissionfalls through to an explicit grant for those, so an administrator needs membership in the Purchaser or RI Exchanger group (or a custom group granting them) to perform them. A plain tick on Administrators'execute,approve-anyandretry-anyrows would therefore claim more than the backend allows. The*and its tooltip show that the tick holds for every resource except the carved-out ones.Screenshots
Before = main at 43dd618; after = this branch. Headless Chromium at 1440x900 against a mocked API with the seeded groups (Administrators
admin:*, Purchaser, RI Exchanger and so on) plus two custom groups.approve-anyand Standard Users'cancel-owndon't appear.*on execute, approve-any and retry-any; the variant grants appear; a note explains the grey ticks.Verification
Run on this branch's head
a8616073(main 43dd618 + 2 commits), fromfrontend/:npm run typecheck: pass.npm run lint: 0 errors (141 warnings, the same as main).npm run build: pass.permission-matrix.test.tsadds 6 tests).e2e-local.sh, the repo's full suite): 276 passed.Notes for review
ADMIN_CARVED_OUTS, so it follows that set if it changes. Its comment already says it must mirror the backend'sadminCarvedOuts.Overlaps
frontend/src/styles/settings.cssis also touched by ui(settings): admin settings sections as cards with visible hints #1606, ui(accounts): account and registration row actions as icon buttons #1608, ui(settings): quiet danger style for Reset to Defaults #1609 and ui(accounts): accounts page polish (federation cards, file picker) #1611. All pairs merge cleanly in any order. No other sweep PR touchespermissionMatrix.tsorpermissions.ts.Note for the UI owner
This changes UI code that @cristim owns. IAmJSD reviewed the before/after screenshots and asked for these PRs; any design point you disagree with can be a follow-up.
🤖 Generated with Claude Code