Generated with the help of an LLM.
I used Claude to help write this summary, the code and the test. I reviewed and tested everything myself.
Problem/Motivation
Child of #3561626. The role add route (user.role_add, /admin/people/roles/add) only checks the administer permissions permission, so
hook_entity_create_access() and hook_ENTITY_TYPE_create_access() are never called for it. A module that forbids creating user_role entities
can't block the add form.
Proposed resolution
Use _entity_create_access instead of _permission on this route, like the menu, text format and language add routes already do. The admin permission of
user_role is administer permissions, so nothing changes for sites that don't implement the hook.
Remaining tasks
Review the MR.
Issue fork drupal-3644297
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
deruina commentedMR is up.
Comment #4
deruina commentedSetting to Needs review, wrong status in my last comment.
Comment #5
deruina commentedFollowing @smustgrave's feedback on the sibling issue #3643704, I moved the test into the existing
UserRoleEntityTestastestRoleAddRouteAccess()anddeleted the new test file. It still fails without the routing change.