comparison core/modules/taxonomy/src/VocabularyAccessControlHandler.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents
children
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
1 <?php
2
3 namespace Drupal\taxonomy;
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 taxonomy vocabulary entity type.
12 *
13 * @see \Drupal\taxonomy\Entity\Vocabulary
14 */
15 class VocabularyAccessControlHandler extends EntityAccessControlHandler {
16
17 /**
18 * {@inheritdoc}
19 */
20 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
21 switch ($operation) {
22 case 'access taxonomy overview':
23 case 'view':
24 return AccessResult::allowedIfHasPermissions($account, ['access taxonomy overview', 'administer taxonomy'], 'OR');
25
26 default:
27 return parent::checkAccess($entity, $operation, $account);
28 }
29 }
30
31 }