Interim commit.
[yaffs-website] / web / modules / contrib / environment_indicator / src / EnvironmentIndicatorAccessControlHandler.php
1 <?php
2
3 namespace Drupal\environment_indicator;
4
5 use Drupal\Core\Access\AccessResult;
6 use Drupal\Core\Entity\EntityAccessControlHandler;
7 use Drupal\Core\Entity\EntityInterface;
8 use Drupal\Core\Session\AccountInterface;
9
10 /**
11  * Defines an access controller for the environment entity.
12  *
13  * @see \Drupal\environment_indicator\Plugin\Core\Entity\EnvironmentIndicator.
14  */
15 class EnvironmentIndicatorAccessControlHandler extends EntityAccessControlHandler {
16
17   /**
18    * {@inheritdoc}
19    */
20   protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
21     return AccessResult::allowedIf($account->hasPermission('administer environment indicator settings'));
22   }
23
24   /**
25    * {@inheritdoc}
26    */
27   protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
28     return AccessResult::allowedIf($account->hasPermission('administer environment indicator settings'));
29   }
30
31 }