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

Command icon 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

deruina created an issue. See original summary.

deruina’s picture

Status: Active » Needs work

MR is up.

deruina’s picture

Status: Needs work » Needs review

Setting to Needs review, wrong status in my last comment.

deruina’s picture

Following @smustgrave's feedback on the sibling issue #3643704, I moved the test into the existing UserRoleEntityTest as testRoleAddRouteAccess() and
deleted the new test file. It still fails without the routing change.