annotate core/modules/taxonomy/src/VocabularyAccessControlHandler.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 1fec387a4317
children
rev   line source
Chris@14 1 <?php
Chris@14 2
Chris@14 3 namespace Drupal\taxonomy;
Chris@14 4
Chris@14 5 use Drupal\Core\Access\AccessResult;
Chris@14 6 use Drupal\Core\Entity\EntityAccessControlHandler;
Chris@14 7 use Drupal\Core\Entity\EntityInterface;
Chris@14 8 use Drupal\Core\Session\AccountInterface;
Chris@14 9
Chris@14 10 /**
Chris@14 11 * Defines the access control handler for the taxonomy vocabulary entity type.
Chris@14 12 *
Chris@14 13 * @see \Drupal\taxonomy\Entity\Vocabulary
Chris@14 14 */
Chris@14 15 class VocabularyAccessControlHandler extends EntityAccessControlHandler {
Chris@14 16
Chris@14 17 /**
Chris@14 18 * {@inheritdoc}
Chris@14 19 */
Chris@14 20 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
Chris@14 21 switch ($operation) {
Chris@14 22 case 'access taxonomy overview':
Chris@14 23 case 'view':
Chris@14 24 return AccessResult::allowedIfHasPermissions($account, ['access taxonomy overview', 'administer taxonomy'], 'OR');
Chris@14 25
Chris@14 26 default:
Chris@14 27 return parent::checkAccess($entity, $operation, $account);
Chris@14 28 }
Chris@14 29 }
Chris@14 30
Chris@14 31 }