Skip to content

Commit 842674f

Browse files
committed
Revert "Issue #2135445 by dww, Sam152, jessebeach, Mile23, Kristen Pol, Wim Leers, larowlan: Toolbar displays Manage tab even if the user is not permitted to see it"
This reverts commit f458f5a290343438428b63a96a33cb63ee96a23b.
1 parent c08049b commit 842674f

File tree

4 files changed

+0
-31
lines changed

4 files changed

+0
-31
lines changed

modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ protected function setUp() {
3030

3131
$user = $this->createUser([
3232
'administer blocks',
33-
'access administration pages',
3433
'access contextual links',
3534
'access toolbar',
3635
'administer nodes',

modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -394,23 +394,6 @@ public function testExternalLink() {
394394
$this->assertRaw('title="External URL & escaped"');
395395
}
396396

397-
/**
398-
* Tests that there is no Manage tab in the Toolbar for authenticated users.
399-
*
400-
* The authorized user should not have a Manage tab simply with the 'access
401-
* toolbar' permission. They need 'access administration pages' for that.
402-
*/
403-
public function testEmptyMenuTray() {
404-
// Log out the admin user because we're testing restricted access.
405-
$this->drupalLogout();
406-
$this->drupalLogin($this->drupalCreateUser(['access toolbar']));
407-
$this->assertResponse(200);
408-
// @todo The toolbar div itself still has the id "toolbar-administration".
409-
// @see https://www.drupal.org/project/drupal/issues/1044090
410-
$this->assertSession()->elementExists('css', 'div[id=toolbar-administration]');
411-
$this->assertSession()->elementNotExists('css', 'a[id=toolbar-item-administration]');
412-
}
413-
414397
/**
415398
* Get the hash value from the admin menu subtrees route path.
416399
*

modules/toolbar/tests/src/FunctionalJavascript/ToolbarIntegrationTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class ToolbarIntegrationTest extends WebDriverTestBase {
2222
public function testToolbarToggling() {
2323
$admin_user = $this->drupalCreateUser([
2424
'access toolbar',
25-
'access administration pages',
2625
'administer site configuration',
2726
'access content overview',
2827
]);

modules/toolbar/toolbar.module

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,6 @@ function toolbar_toolbar() {
159159
'#weight' => -20,
160160
];
161161

162-
// If the current user cannot access administration pages, we can save a large
163-
// amount of unnecessary work by ending here. It'd be better to actually know
164-
// if the admin menu tree is empty for them, but trying to load that tree only
165-
// happens in a #pre_render callback, and at that point, it's too late. The
166-
// entire toolbar is rendered with the 'user.permissions' #cache context, so
167-
// we can safely do this here and it'll still be cached correctly.
168-
// @see toolbar_prerender_toolbar_administration_tray()
169-
// @see toolbar_page_top()
170-
if (!\Drupal::currentUser()->hasPermission('access administration pages')) {
171-
return $items;
172-
}
173-
174162
// To conserve bandwidth, we only include the top-level links in the HTML.
175163
// The subtrees are fetched through a JSONP script that is generated at the
176164
// toolbar_subtrees route. We provide the JavaScript requesting that JSONP

0 commit comments

Comments
 (0)