Problem/Motivation

The config_pages.type_add route requires a permission explicitly.
It is a better practice to use the _entity_create_access requirement, this way access can be altered with hook_entity_create_access.

Steps to reproduce

Add this hook:

/**
 * Implements hook_entity_create_access().
 */
function test_entity_create_access() {
  return AccessResult::forbidden();
}

You can still create config page types.

Proposed resolution

Replace the _permission requirement with _entity_create_access.

Remaining tasks

User interface changes

API changes

Data model changes

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

prudloff created an issue. See original summary.

aayushpathak’s picture

working..

aayushpathak’s picture

Status: Active » Needs review
shumer’s picture

We have failed access tests for this MR.

aayushpathak’s picture

The failure in testAccessDenied seems to come from a change in access behavior after introducing _entity_create_access. The test still expects a 403 based on permission checks, while the route now returns 200. This looks like a mismatch between the updated access mechanism and existing test expectations