You are here

public function BlockPermissionsAccessControlHandler::blockFormAccess in Block permissions 8

Access check for the block config form.

Parameters

\Drupal\block\Entity\Block $block: The theme name.

Return value

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

File

src/BlockPermissionsAccessControlHandler.php, line 130

Class

BlockPermissionsAccessControlHandler
Controller for the block permissions.

Namespace

Drupal\block_permissions

Code

public function blockFormAccess(Block $block) {
  $plugin = $block
    ->getPlugin();
  $configuration = $plugin
    ->getConfiguration();

  // Check if the user has the proper permissions.
  $access = AccessResult::allowedIfHasPermission($this->currentUser, 'administer blocks provided by ' . $configuration['provider']);
  return $access;
}