User permissions: redesigned grouped capability editor + catalog - #482
Merged
Conversation
Rebuilds the per-user FFC capability section on the WordPress user-edit screen as a grouped, card-based panel and fixes a latent save bug. - New CapabilityCatalog: single source of truth mapping every cap slug to a label, description, domain group and level. CI asserts it covers exactly CapabilityManager::get_all_capabilities(). - Render: grouped collapsible cards (admin groups start collapsed), live search across label+slug, Grant/Revoke-all presets, copyable monospace slug chip per row, origin badge (User vs Role), live per-group count, and a read-only role + audiences context summary (role stays in WP's native selector; audiences link to the Audiences screen). - Fix: the old form rendered ~10 of ~26 caps while save iterated all of them, so every cap without a checkbox was silently remove_cap()'d on save. Render and save now both derive from the catalog. - Assets: new ffc-user-permissions.css; ffc-user-capabilities.js rewritten (vanilla, no jQuery) for presets/search/collapse/copy/live-count. - Tests: CapabilityCatalogTest (registry parity + metadata), updated AdminUserCapabilitiesTest (new markup + enqueue), new Vitest suite, and retired the superseded tiny-scripts block. - Includes the design mockup under docs/mockups/.
rpgmem
marked this pull request as ready for review
June 3, 2026 10:27
rpgmem
enabled auto-merge (squash)
June 3, 2026 10:27
Turns the read-only audiences summary into an inline editor: a checklist of every active audience (pre-checked for current memberships), synced on the same profile-form save. - render_audience_membership(): lists active audiences as ffc_audience[] checkboxes with a color dot, pre-checked per membership; links to the Audiences screen. - sync_audience_membership(): whitelists the submission against the active set, diffs against current active memberships, and applies the minimal add_member/remove_member calls. Only active audiences participate, so a membership in an inactive audience is never touched; if no audiences are active (checklist not rendered) it is a no-op, so it can't wipe on an unrelated save. Changes are audit-logged. - CSS: audience checklist styles. Tests: +1 render, +3 save (add / remove on uncheck / no-op when none active).
This was referenced Jun 3, 2026
Closed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Redesigned per-user capability editor (+ editable audience membership)
Rebuilds the FFC permissions section on the WordPress Edit user screen, answering the maintainer's UX ask ("the function is unclear and the admin can't easily understand/cite each capability individually") — and fixing a latent save bug found along the way.
The problems (before)
__()strings with no central registry → nothing the admin could cite.remove_cap()'d on each save — e.g. opening + saving anffc_user's profile would strip a per-userffc_manage_recruitmentgrant.The redesign
CapabilityCatalog— single source of truth:slug → {label, description, group, level}for all 26 caps. CI asserts it covers exactlyCapabilityManager::get_all_capabilities(), so adding a registry cap without metadata fails the build.Context & groups
sync_audience_membership()whitelists the submission against the active set and diffs against the current memberships, applying the minimaladd_member/remove_membercalls. Only active audiences participate, so a membership in an inactive audience is never touched; if no audiences are active (the checklist wouldn't render) the sync is a no-op so it can't wipe membership on an unrelated save. Changes are audit-logged. A link through to the Audiences screen remains for bulk management.Assets & tests
ffc-user-permissions.css;ffc-user-capabilities.jsrewritten (vanilla, no jQuery) for presets/search/collapse/copy/live-count.npm run buildran (min bundles in sync).CapabilityCatalogTest(registry parity + metadata), updatedAdminUserCapabilitiesTest(new markup, enqueue, the formerly-hidden admin caps now render, audience checklist render + membership add/remove/no-op save), new Vitestuser-capabilities.test.js, retired the supersededtiny-scriptsblock.docs/mockups/user-permissions-redesign.html.Targets
develop; noFFC_VERSIONbump (belongs to the release PR). CHANGELOG under[Unreleased].https://claude.ai/code/session_011ErkuJ7jnF9zkqCkGs3qKN