3 namespace Drupal\environment_indicator;
5 use Drupal\Core\Access\AccessResult;
6 use Drupal\Core\Entity\EntityAccessControlHandler;
7 use Drupal\Core\Entity\EntityInterface;
8 use Drupal\Core\Session\AccountInterface;
11 * Defines an access controller for the environment entity.
13 * @see \Drupal\environment_indicator\Plugin\Core\Entity\EnvironmentIndicator.
15 class EnvironmentIndicatorAccessControlHandler extends EntityAccessControlHandler {
20 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
21 return AccessResult::allowedIf($account->hasPermission('administer environment indicator settings'));
27 protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
28 return AccessResult::allowedIf($account->hasPermission('administer environment indicator settings'));