Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/tour/src/TourAccessControlHandler.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\tour; | |
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 the access control handler for the tour entity type. | |
12 * | |
13 * @see \Drupal\tour\Entity\Tour | |
14 */ | |
15 class TourAccessControlHandler extends EntityAccessControlHandler { | |
16 | |
17 /** | |
18 * {@inheritdoc} | |
19 */ | |
20 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { | |
21 if ($operation === 'view') { | |
22 return AccessResult::allowedIfHasPermissions($account, ['access tour', 'administer site configuration'], 'OR'); | |
23 } | |
24 | |
25 return parent::checkAccess($entity, $operation, $account); | |
26 } | |
27 | |
28 } |