You are here

protected function DomainPathAccessControlHandler::checkAccess in Domain Path 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/DomainPathAccessControlHandler.php, line 21

Class

DomainPathAccessControlHandler
Access controller for the domain paths.

Namespace

Drupal\domain_path

Code

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