You are here

protected function HostAccessControlHandler::checkAccess in http:BL 8

Link the activities to the permissions. checkAccess is called with the $operation as defined in the routing.yml file.

Overrides EntityAccessControlHandler::checkAccess

File

src/HostAccessControlHandler.php, line 23

Class

HostAccessControlHandler
Access controller for the host entity.

Namespace

Drupal\httpbl

Code

protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
  switch ($operation) {
    case 'view':
      return AccessResult::allowedIfHasPermission($account, 'view host entity');
    case 'edit':
      return AccessResult::allowedIfHasPermission($account, 'edit host entity');
    case 'delete':
      return AccessResult::allowedIfHasPermission($account, 'delete host entity');
  }
  return AccessResult::allowed();
}