You are here

public function ReusableBlocksController::access in Gutenberg 8

Same name and namespace in other branches
  1. 8.2 src/Controller/ReusableBlocksController.php \Drupal\gutenberg\Controller\ReusableBlocksController::access()

Controller routes access callback.

Parameters

\Drupal\Core\Session\AccountInterface $account: Current user.

string $block_id: Block id from route parameter.

Return value

\Drupal\Core\Access\AccessResult Allowed access result if all conditions are met.

1 string reference to 'ReusableBlocksController::access'
gutenberg.routing.yml in ./gutenberg.routing.yml
gutenberg.routing.yml

File

src/Controller/ReusableBlocksController.php, line 155

Class

ReusableBlocksController
Returns responses for our blocks routes.

Namespace

Drupal\gutenberg\Controller

Code

public function access(AccountInterface $account, $block_id) {
  return AccessResult::allowedIf($account
    ->hasPermission('gutenberg administer') && $this
    ->isBundleOfReusableBlock($block_id));
}