class CustomBlockAccessController

Defines the access controller for the custom block entity type.

Hierarchy

Expanded class hierarchy of CustomBlockAccessController

File

drupal/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockAccessController.php, line 17
Contains \Drupal\custom_block\CustomBlockAccessController.

Namespace

Drupal\custom_block
View source
class CustomBlockAccessController extends EntityAccessController {

  /**
   * {@inheritdoc}
   */
  protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
    if ($operation === 'view') {
      return TRUE;
    }
    elseif (in_array($operation, array(
      'create',
      'update',
      'delete',
    ))) {
      return user_access('administer blocks', $account);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CustomBlockAccessController::checkAccess protected function Performs access checks. Overrides EntityAccessController::checkAccess
EntityAccessController::$accessCache protected property Stores calculcated access check results.
EntityAccessController::access public function Checks access to an operation on a given entity or entity translation. Overrides EntityAccessControllerInterface::access 1
EntityAccessController::getCache protected function Tries to retrieve a previously cached access value from the static cache.
EntityAccessController::resetCache public function Clears all cached access checks. Overrides EntityAccessControllerInterface::resetCache
EntityAccessController::setCache protected function Statically caches whether the given user has access.