Roles: global role-capability editor on Settings → User Access (Frente B) - #487
Merged
Conversation
…e B) The global-scope half of the permissioning split (#484): edit which FFC capabilities each FFC role grants, from Settings → User Access. The per-user panel assigns roles + fine-tunes one user; this editor changes the role definition itself. - RoleCapabilityEditor: pick an FFC role, toggle its cataloged caps. Reuses the CapabilityCatalog grouped-card / search / slug-chip UI; shows each role's member count + a prominent global/retroactive impact banner. - Persistence is per-toggle via an isolated AJAX endpoint (wp_ajax_ffc_set_role_cap → WP_Role add_cap/remove_cap), separate from the User Access options form on the same tab. Restricted to CapabilityManager::ffc_managed_role_labels() and to cataloged caps — never touches core/super roles or non-FFC caps; cap- + nonce-gated; audit-logged. - CapabilityManager::ffc_managed_role_labels() exposes the canonical FFC role set (extracted from relabel_ffc_roles). - Rendered from the user-access tab view, outside the settings <form>. - Tests: +8 PHPUnit (editable-role discovery, role→caps map, render smoke, AJAX grant/remove + role/cap/cap-guard), +3 Vitest (role-picker swap, persist success, failure revert). Closes #484.
rpgmem
marked this pull request as ready for review
June 3, 2026 15:32
rpgmem
enabled auto-merge (squash)
June 3, 2026 15:33
WPCS 3.3.0 (CI) rejects a list<...> pseudo-type on a parameter docblock
("Expected type hint list<string>; found array"). Match the codebase's
array<...> param convention; the value passed is still a list<string>.
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.
What (Frente B) — closes #484
The global-scope half of the permissioning split: a role-capability editor on Settings → User Access. Pick an FFC role and toggle which catalog capabilities it grants — editing the role definition itself.
This is the counterpart to the per-user panel:
UX
<select>with each role's member count; switching swaps the toggles to that role's caps (live).Safety
wp_ajax_ffc_set_role_cap→WP_Role::add_cap/remove_cap) — separate from the User Access options form on the same tab, so the two saves never collide.CapabilityManager::ffc_managed_role_labels()) and to cataloged caps — core/super roles and non-FFC caps are never touched.Tests & gates
AdminUI::get_togglereturns empty for an emptyname, so the toggles weren't rendering; fixed.npm run buildran.Targets
develop; noFFC_VERSIONbump. CHANGELOG[Unreleased]updated.https://claude.ai/code/session_011ErkuJ7jnF9zkqCkGs3qKN
Generated by Claude Code