diff -u b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php --- b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php +++ b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php @@ -21,4 +21,12 @@ /** + * Route names to check menu link access. + */ + const static::FORCE_ACCESS_CHECK = [ + 'user.logout', + 'user.login' + ]; + + /** * The access manager. * @@ -200,7 +208,7 @@ */ protected function menuLinkCheckAccess(MenuLinkInterface $instance, $link_access = FALSE) { $access_result = NULL; - if ((!$link_access) && ($this->account->hasPermission('link to any page'))) { + if (!in_array($link->getRouteName(), static::FORCE_ACCESS_CHECK, TRUE) && $this->account->hasPermission('link to any page')) { $access_result = AccessResult::allowed(); } else { diff -u b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php --- b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php @@ -1058,8 +1058,9 @@ 'administer blocks', 'administer menu', 'create article content', - 'link to any page' + 'link to any page', ]); + // Log in with created user. $this->drupalLogin($adminUserWithLinkAnyPage); $this->addMenuLink('', '/user/login', 'main'); @@ -1073,2 +1074,3 @@ } + }