This repository has been archived on 2022-07-12. You can view files and clone it, but cannot push or open issues or pull requests.
2018-06-18 16:15:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Drupal\opencase_entities;
|
|
|
|
|
|
|
|
use Drupal\Core\Entity\EntityAccessControlHandler;
|
|
|
|
use Drupal\Core\Session\AccountInterface;
|
|
|
|
use Drupal\Core\Entity\EntityInterface;
|
|
|
|
use Drupal\Core\Access\AccessResult;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines the access control handler for the OCCaseType Config Entity.
|
|
|
|
* Always allows viewing the label of the bundle.
|
|
|
|
*
|
|
|
|
* @see Drupal\opencase_entities\Entity\OCCaseType
|
|
|
|
*/
|
|
|
|
class OCCaseTypeAccessControlHandler extends EntityAccessControlHandler {
|
|
|
|
|
|
|
|
protected $viewLabelOperation = TRUE;
|
|
|
|
|
|
|
|
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
|
|
|
if ($operation == 'view label') {
|
|
|
|
return AccessResult::allowed();
|
|
|
|
}
|
2018-06-29 12:51:12 +00:00
|
|
|
return parent::checkAccess($entity, $operation, $account);
|
2018-06-18 16:15:00 +00:00
|
|
|
}
|
|
|
|
}
|