function TourAccessControlHandler::checkAccess

Same name in other branches
  1. 9 core/modules/tour/src/TourAccessControlHandler.php \Drupal\tour\TourAccessControlHandler::checkAccess()
  2. 10 core/modules/tour/src/TourAccessControlHandler.php \Drupal\tour\TourAccessControlHandler::checkAccess()
  3. 11.x core/modules/tour/src/TourAccessControlHandler.php \Drupal\tour\TourAccessControlHandler::checkAccess()

Overrides EntityAccessControlHandler::checkAccess

File

core/modules/tour/src/TourAccessControlHandler.php, line 20

Class

TourAccessControlHandler
Defines the access control handler for the tour entity type.

Namespace

Drupal\tour

Code

protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    if ($operation === 'view') {
        return AccessResult::allowedIfHasPermissions($account, [
            'access tour',
            'administer site configuration',
        ], 'OR');
    }
    return parent::checkAccess($entity, $operation, $account);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.