Skip to content

fix(acl): resolve renamed Resource policy for parallel groups - #16996

Open
Ibochkarev wants to merge 1 commit into
modxcms:3.xfrom
Ibochkarev:fix/issue-13831-parallel-resource-group-policy
Open

fix(acl): resolve renamed Resource policy for parallel groups#16996
Ibochkarev wants to merge 1 commit into
modxcms:3.xfrom
Ibochkarev:fix/issue-13831-parallel-resource-group-policy

Conversation

@Ibochkarev

Copy link
Copy Markdown
Collaborator

What changed and why

Renaming the core Access Policy Resource broke “create parallel resource group” on user group create: the wizard looked up the policy by the literal name Resource, returned null, and never wrote modAccessResourceGroup rows (#13831).

modAccessPolicy::getPolicy() resolves the shipped name first. If missing, and the policy maps 1:1 to a core template (Resource / Element / Context / Hidden Namespace) with exactly one policy on that template, it returns that policy. Multiple policies on the template fail closed (null).

User/resource group create wizards now call getPolicy() with POLICY_* constants.

Out of scope (per issue comments): making core policies read-only. Duplicate-and-customize remains the recommended workflow; this fix only unbreaks rename.

How to test

  1. Rename Access Policy Resource to another name.
  2. Create a user group with “create parallel resource group” enabled for a context.
  3. Confirm a resource group ACL appears under Permissions / User group access.
  4. Gate E:
    • php -l core/src/Revolution/modAccessPolicy.php → exit 0
    • composer run-script phpunit -- --filter modAccessPolicyTest → OK (3 tests, 9 assertions)

Related issue(s)/PR(s)

Resolves #13831

Compatibility notes

Affects ACL wizards that previously hardcoded core policy names. Sites that never rename core policies behave as before. If the Resource policy was deleted and replaced with multiple custom policies on ResourceTemplate, parallel-group ACL creation still fails closed (same as a missing policy).

Breaking change assessment

No public method signatures removed. Adds modAccessPolicy::getPolicy(). Safe for patch consumers.

Test coverage

_build/test/Tests/Model/Security/modAccessPolicyTest.php: resolve by name, resolve after rename, fail closed when two policies share ResourceTemplate.

Contributors

Thanks @intersel for the report and pinpointing addParallelResourceGroup, @wshawn for the duplicate-vs-rename guidance, and @alroniks for confirming 3.x.

AI tool use

Cursor agent assisted implementation, tests, review loops, and PR prose. Human review still required before merge.

Lookup core Access Policies by shipped name with a fail-closed
template fallback so renaming Resource no longer breaks
addParallelResourceGroup (modxcms#13831).
@Ibochkarev Ibochkarev added area-acl bug The issue in the code or project, which should be addressed. labels Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-acl bug The issue in the code or project, which should be addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename the policy "Resource" with another policy name prevents addParallelResourceGroup to work

1 participant