Admin page access denied even when access is given to child items

Created on 9 January 2024, about 1 year ago
Updated 11 July 2024, 9 months ago

Problem/Motivation

πŸ› Restrict access to empty top level administration pages Fixed introduced a bug where if a user does not have access to the child items of the first item of an admin page, the page gives an access denied, even if the user does have access to some other items. For me the first item was entity.taxonomy_vocabulary.collection, so denying access to that item resulted in the user not being able to access /admin/structure even though they did have access to add/edit menus.

Steps to reproduce

composer create-project drupal/recommended-project drupal.local
cd drupal.local
composer require drush/drush
vendor/bin/drush site:install
vendor/bin/drush user:create Jelle
vendor/bin/drush user:role:add content_editor Jelle
vendor/bin/drush role:perm:add content_editor "access taxonomy overview"

# Login as user 2 and check the toolbar, "Structure" should be there

composer require drupal/scheduler
vendor/bin/drush en scheduler

# Login as user 2 and check the toolbar, "Structure" is gone

Proposed resolution

Only do an early return in \Drupal\system\Access\SystemAdminMenuBlockAccessCheck::hasAccessToChildMenuItems if a child menu item is found where the user does have access to. Don't just check the first one.

Remaining tasks


Fix tests so they fail without the fix, these were broken in the reroll see #39

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

If users have access to a child of an admin page, but not its first child, they will now have access to that admin page.

πŸ› Bug report
Status

Fixed

Version

10.3 ✨

Component
SystemΒ  β†’

Last updated 2 days ago

No maintainer
Created by

πŸ‡§πŸ‡ͺBelgium jelle_s Antwerp, Belgium

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024