You are here

public function ToolbarController::checkSubTreeAccess in Drupal 9

Same name and namespace in other branches
  1. 8 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 52

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();
}