Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. VocabularyAccessControlHandler.php

function VocabularyAccessControlHandler::checkAccess

Overrides EntityAccessControlHandler::checkAccess

File

core/modules/taxonomy/src/VocabularyAccessControlHandler.php, line 25

Class

VocabularyAccessControlHandler
Defines the access control handler for the taxonomy vocabulary entity type.

Namespace

Drupal\taxonomy

Code

protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    switch ($operation) {
        case 'view label':
            return AccessResult::allowedIfHasPermissions($account, [
                'view vocabulary labels',
                'access taxonomy overview',
                'administer taxonomy',
            ], 'OR');
        case 'access taxonomy overview':
        case 'view':
            return AccessResult::allowedIfHasPermissions($account, [
                'access taxonomy overview',
                'administer taxonomy',
            ], 'OR');
        case 'reset all weights':
            return AccessResult::allowedIfHasPermissions($account, [
                'administer taxonomy',
                'edit terms in ' . $entity->id(),
            ], 'OR');
        default:
            return parent::checkAccess($entity, $operation, $account);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal