Menu links, created via Views, are filtered out

Created on 10 May 2023, over 1 year ago
Updated 11 October 2023, about 1 year ago

Problem/Motivation

Menu links created via Views don't have a route name. This results in a forbidden-response from the AccessManager.

Steps to reproduce

- Create a new View (type = page) and create a menu link
-- See https://git.drupalcode.org/project/rest_log/-/blob/2.x/config/install/vi...
- Notice the link is visible in the admin-menu
- Enable admin_toolbar_links_access_filter
- Notice the link is not rendered anymore

Proposed resolution

Use the routename of the url-object when the routename of the menu link is an empty string.

Remaining tasks

-

User interface changes

- Menu links without a routename become visible

📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇧🇪Belgium lammensj

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

Comments & Activities

  • Issue created by @lammensj
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    17 pass
  • @lammensj opened merge request.
  • Assigned to Anmol_Specbee
  • Status changed to Fixed over 1 year ago
  • 🇨🇦Canada adriancid Montreal, Canada

    Thanks

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Issue was unassigned.
  • Status changed to Fixed over 1 year ago
  • I would like to politely suggest that this issue please be reopened.

    The changes made in this issue, merged into version 3.4.0, meant that when we upgraded from version 3.3.2, while Admin users were totally unaffected, non-Admin users could no longer log into the site, which was in fact broken for them at that point ("The website encountered an unexpected error."). The logs show that this was due to a PHP error:

    UnexpectedValueException: base:devel/taxonomy_vocabulary/<vocabulary-name> has no corresponding route. in Drupal\Core\Url->getRouteName() (line 567 of /core/lib/Drupal/Core/Url.php).

    Indeed, this error didn't occur on versions of the site where the Devel module was already enabled, and cycling between enabled and disabled on any server in pre-production essentially served as a switch to turn the above error off and on at will. However, as we don't want Devel enabled everywhere for performance (and other) reasons, this was only a temporary solution.

    I narrowed the problem down further to the access check being done in the lines surrounding the diff on this merged issue, and simply reversed the changes therein - the problem is now gone for us whether Devel is enabled or not, but of course, this is at the expense of the desired outcome of the entire issue raised here. This doesn't seem to affect us for now but is obviously of relevance to you and perhaps to other people using the module, suggesting the main issue here has not really been fully tested and/or resolved yet.

  • I also had an issue related to this fix. I opened new task and fixed it here: https://www.drupal.org/project/admin_toolbar/issues/3393162 🐛 Base path in admin menu cause error to non admin users. Needs review

Production build 0.71.5 2024