Problem/Motivation

admin_toolbar_links_access_filter_filter_non_accessible_links treat the menu item keys as route names but they are actually the menu id's. We can see that logic at the end of MenuLinkTree::buildItems

We can confirm this by seeing non routable id's in the list like admin_toolbar_tools.extra_links:flush_views

This was sort of a big performance hit prior to #3209342: Links without "original_link" are filtered by admin_toolbar_links_access_filter because we would do access checks on all these non-routable names. That seems to be fixed but the code still treats the key incorrectly.

Steps to reproduce

I haven't found a specific bug yet because #3209342: Links without "original_link" are filtered by admin_toolbar_links_access_filter seems to have fixed the problem I was running into this just needs to be cleaned to avoid future bugs I think. Maybe fix some edge case I haven't found.

Proposed resolution

Change the variable name and make sure the method only uses the resolved route name instead of the menu id.

CommentFileSizeAuthor
#2 route_name_fix-3213710-2.patch2.74 KBneclimdul

Comments

neclimdul created an issue. See original summary.

neclimdul’s picture

Status: Active » Needs review
StatusFileSize
new2.74 KB

This is the only notable change. Using route_name instead of the menu item key for the admin_toolbar_links_access_filter_is_overview_page call.

-        if (admin_toolbar_links_access_filter_is_overview_page($route)) {
-          unset($items[$route]);
+        if (admin_toolbar_links_access_filter_is_overview_page($route_name)) {
+          unset($items[$menu_id]);
adriancid’s picture

Status: Needs review » Fixed

Thanks

Status: Fixed » Closed (fixed)

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