function ToolbarController::checkSubTreeAccess

Same name in other branches
  1. 8.9.x core/modules/toolbar/src/Controller/ToolbarController.php \Drupal\toolbar\Controller\ToolbarController::checkSubTreeAccess()
  2. 10 core/modules/toolbar/src/Controller/ToolbarController.php \Drupal\toolbar\Controller\ToolbarController::checkSubTreeAccess()
  3. 11.x core/modules/toolbar/src/Controller/ToolbarController.php \Drupal\toolbar\Controller\ToolbarController::checkSubTreeAccess()

Checks access for the subtree controller.

Parameters

string $hash: The hash of the toolbar subtrees.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

1 string reference to 'ToolbarController::checkSubTreeAccess'
toolbar.routing.yml in core/modules/toolbar/toolbar.routing.yml
core/modules/toolbar/toolbar.routing.yml

File

core/modules/toolbar/src/Controller/ToolbarController.php, line 53

Class

ToolbarController
Defines a controller for the toolbar module.

Namespace

Drupal\toolbar\Controller

Code

public function checkSubTreeAccess($hash) {
    $expected_hash = _toolbar_get_subtrees_hash()[0];
    return AccessResult::allowedIf($this->currentUser()
        ->hasPermission('access toolbar') && hash_equals($expected_hash, $hash))
        ->cachePerPermissions();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.