You are here

public function ToolbarController::checkSubTreeAccess in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 55
Contains \Drupal\toolbar\Controller\ToolbarController.

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') && Crypt::hashEquals($expected_hash, $hash))
    ->cachePerPermissions();
}