comparison core/modules/field/src/FieldConfigAccessControlHandler.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\field;
4
5 use Drupal\Core\Entity\EntityAccessControlHandler;
6 use Drupal\Core\Entity\EntityInterface;
7 use Drupal\Core\Session\AccountInterface;
8
9 /**
10 * Defines the access control handler for the field config entity type.
11 *
12 * @see \Drupal\field\Entity\FieldConfig
13 */
14 class FieldConfigAccessControlHandler extends EntityAccessControlHandler {
15
16 /**
17 * {@inheritdoc}
18 */
19 protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
20 // Delegate access control to the underlying field storage config entity:
21 // the field config entity merely handles configuration for a particular
22 // bundle of an entity type, the bulk of the logic and configuration is with
23 // the field storage config entity. Therefore, if an operation is allowed on
24 // a certain field storage config entity, it should also be allowed for all
25 // associated field config entities.
26 // @see \Drupal\Core\Field\FieldDefinitionInterface
27 /** \Drupal\field\FieldConfigInterface $entity */
28 $field_storage_entity = $entity->getFieldStorageDefinition();
29 return $field_storage_entity->access($operation, $account, TRUE);
30 }
31
32 }