diff options
author | Alex Pott | 2014-08-07 22:27:28 (GMT) |
---|---|---|
committer | Alex Pott | 2014-08-07 22:27:28 (GMT) |
commit | 258856aee9940b0d59077d62eb7a3c8f155dd7f4 (patch) | |
tree | ec5dbdfa0e0f40c6ec2b9290ea72a6c3635591e1 | |
parent | a04820c1da4c778fc481bd64967451be205e1b1f (diff) |
Issue #2154435 by andypost, Berdir, mparker17: Rename EntityAccessController to EntityAccessControlHandler.
92 files changed, 297 insertions, 276 deletions
diff --git a/core/includes/entity.inc b/core/includes/entity.inc index 67b3738..40ef0e9 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -314,25 +314,6 @@ function entity_page_label(EntityInterface $entity, $langcode = NULL) { } /** - * Returns the entity access controller for the given entity type. - * - * @param string $entity_type - * The type of the entity. - * - * @return \Drupal\Core\Entity\EntityAccessControllerInterface - * An entity access controller instance. - * - * @see \Drupal\Core\Entity\EntityManagerInterface::getAccessController(). - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal::entityManager()->getAccessController(). - */ -function entity_access_controller($entity_type) { - return \Drupal::entityManager() - ->getAccessController($entity_type); -} - -/** * Returns the render array for an entity. * * @param \Drupal\Core\Entity\EntityInterface $entity diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index fa2c472..dcaebc7 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -550,11 +550,11 @@ abstract class ContentEntityBase extends Entity implements \IteratorAggregate, C public function access($operation, AccountInterface $account = NULL) { if ($operation == 'create') { return $this->entityManager() - ->getAccessController($this->entityTypeId) + ->getAccessControlHandler($this->entityTypeId) ->createAccess($this->bundle(), $account); } return $this->entityManager() - ->getAccessController($this->entityTypeId) + ->getAccessControlHandler($this->entityTypeId) ->access($this, $operation, $this->activeLangcode, $account); } diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index cf18d55..452f8c7 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -280,11 +280,11 @@ abstract class Entity implements EntityInterface { public function access($operation, AccountInterface $account = NULL) { if ($operation == 'create') { return $this->entityManager() - ->getAccessController($this->entityTypeId) + ->getAccessControlHandler($this->entityTypeId) ->createAccess($this->bundle(), $account); } return $this->entityManager() - ->getAccessController($this->entityTypeId) + ->getAccessControlHandler($this->entityTypeId) ->access($this, $operation, LanguageInterface::LANGCODE_DEFAULT, $account); } diff --git a/core/lib/Drupal/Core/Entity/EntityAccessController.php b/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php index f20ef9c..e4712e5 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessController.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php @@ -2,32 +2,30 @@ /** * @file - * Contains \Drupal\Core\Entity\EntityAccessController. + * Contains \Drupal\Core\Entity\EntityAccessControlHandler. */ namespace Drupal\Core\Entity; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldItemListInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines a default implementation for entity access controllers. + * Defines a default implementation for entity access control handler. */ -class EntityAccessController extends EntityControllerBase implements EntityAccessControllerInterface { +class EntityAccessControlHandler extends EntityControllerBase implements EntityAccessControlHandlerInterface { /** - * Stores calculcated access check results. + * Stores calculated access check results. * * @var array */ protected $accessCache = array(); /** - * The entity type ID of the access controller instance. + * The entity type ID of the access control handler instance. * * @var string */ @@ -41,7 +39,7 @@ class EntityAccessController extends EntityControllerBase implements EntityAcces protected $entityType; /** - * Constructs an access controller instance. + * Constructs an access control handler instance. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type definition. @@ -64,7 +62,7 @@ class EntityAccessController extends EntityControllerBase implements EntityAcces // Invoke hook_entity_access() and hook_ENTITY_TYPE_access(). Hook results // take precedence over overridden implementations of - // EntityAccessController::checkAccess(). Entities that have checks that + // EntityAccessControlHandler::checkAccess(). Entities that have checks that // need to be done before the hook is invoked should do so by overriding // this method. @@ -78,7 +76,7 @@ class EntityAccessController extends EntityControllerBase implements EntityAcces if (($return = $this->processAccessHookResults($access)) === NULL) { // No module had an opinion about the access, so let's the access - // controller check create access. + // handler check create access. $return = (bool) $this->checkAccess($entity, $operation, $langcode, $account); } return $this->setCache($return, $entity->uuid(), $operation, $langcode, $account); @@ -214,7 +212,7 @@ class EntityAccessController extends EntityControllerBase implements EntityAcces // Invoke hook_entity_create_access() and hook_ENTITY_TYPE_create_access(). // Hook results take precedence over overridden implementations of - // EntityAccessController::checkAccess(). Entities that have checks that + // EntityAccessControlHandler::checkAccess(). Entities that have checks that // need to be done before the hook is invoked should do so by overriding // this method. @@ -228,7 +226,7 @@ class EntityAccessController extends EntityControllerBase implements EntityAcces if (($return = $this->processAccessHookResults($access)) === NULL) { // No module had an opinion about the access, so let's the access - // controller check create access. + // handler check create access. $return = (bool) $this->checkCreateAccess($account, $context, $entity_bundle); } return $this->setCache($return, $cid, 'create', $context['langcode'], $account); diff --git a/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityAccessControlHandlerInterface.php index 2a5851f..52c1b7b 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessControlHandlerInterface.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\Core\Entity\EntityAccessControllerInterface. + * Contains \Drupal\Core\Entity\EntityAccessControlHandlerInterface. */ namespace Drupal\Core\Entity; @@ -14,14 +14,14 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines a common interface for entity access controller classes. + * Defines a common interface for entity access control handlers. */ -interface EntityAccessControllerInterface { +interface EntityAccessControlHandlerInterface { /** * Checks access to an operation on a given entity or entity translation. * - * Use \Drupal\Core\Entity\EntityAccessControllerInterface::createAccess() + * Use \Drupal\Core\Entity\EntityAccessControlHandlerInterface::createAccess() * to check access to create an entity. * * @param \Drupal\Core\Entity\EntityInterface $entity @@ -62,7 +62,7 @@ interface EntityAccessControllerInterface { public function resetCache(); /** - * Sets the module handler for this access controller. + * Sets the module handler for this access control handler. * * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. @@ -77,7 +77,7 @@ interface EntityAccessControllerInterface { * This method does not determine whether access is granted to the entity * itself, only the specific field. Callers are responsible for ensuring that * entity access is also respected, for example by using - * \Drupal\Core\Entity\EntityAccessControllerInterface::access(). + * \Drupal\Core\Entity\EntityAccessControlHandlerInterface::access(). * * @param string $operation * The operation access should be checked for. @@ -92,7 +92,7 @@ interface EntityAccessControllerInterface { * is checked for the field definition, without any specific value * available. Defaults to NULL. * - * @see \Drupal\Core\Entity\EntityAccessControllerInterface::access() + * @see \Drupal\Core\Entity\EntityAccessControlHandlerInterface::access() */ public function fieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account = NULL, FieldItemListInterface $items = NULL); diff --git a/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php index bf7073d..e3fab39 100644 --- a/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php +++ b/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php @@ -69,7 +69,7 @@ class EntityCreateAccessCheck implements AccessInterface { return static::DENY; } } - return $this->entityManager->getAccessController($entity_type)->createAccess($bundle, $account) ? static::ALLOW : static::DENY; + return $this->entityManager->getAccessControlHandler($entity_type)->createAccess($bundle, $account) ? static::ALLOW : static::DENY; } } diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index f0e90e3..c827494 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -271,8 +271,8 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa /** * {@inheritdoc} */ - public function getAccessController($entity_type) { - return $this->getController($entity_type, 'access', 'getAccessClass'); + public function getAccessControlHandler($entity_type) { + return $this->getController($entity_type, 'access', 'getAccessControlClass'); } /** diff --git a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php index 8f4fc27..e4d6b05 100644 --- a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php @@ -106,15 +106,15 @@ interface EntityManagerInterface extends PluginManagerInterface { public function getFieldMapByFieldType($field_type); /** - * Creates a new access controller instance. + * Creates a new access control handler instance. * * @param string $entity_type - * The entity type for this access controller. + * The entity type for this access control handler. * - * @return \Drupal\Core\Entity\EntityAccessControllerInterface. - * A access controller instance. + * @return \Drupal\Core\Entity\EntityAccessControlHandlerInterface. + * A access control handler instance. */ - public function getAccessController($entity_type); + public function getAccessControlHandler($entity_type); /** * Returns the route information for an entity type's bundle. diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index 5ebb0b6..ca24505 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -224,7 +224,7 @@ class EntityType implements EntityTypeInterface { 'bundle' => '' ); $this->controllers += array( - 'access' => 'Drupal\Core\Entity\EntityAccessController', + 'access' => 'Drupal\Core\Entity\EntityAccessControlHandler', ); } @@ -446,7 +446,7 @@ class EntityType implements EntityTypeInterface { /** * {@inheritdoc} */ - public function getAccessClass() { + public function getAccessControlClass() { return $this->getControllerClass('access'); } diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index d92e00b..c4b0496 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -208,8 +208,8 @@ interface EntityTypeInterface { * - render: The name of the class that is used to render the entities. The * class must implement \Drupal\Core\Entity\EntityViewBuilderInterface. * - access: The name of the class that is used for access checks. The class - * must implement \Drupal\Core\Entity\EntityAccessControllerInterface. - * Defaults to \Drupal\Core\Entity\EntityAccessController. + * must implement \Drupal\Core\Entity\EntityAccessControlHandlerInterface. + * Defaults to \Drupal\Core\Entity\EntityAccessControlHandler. */ public function getControllerClasses(); @@ -320,12 +320,12 @@ interface EntityTypeInterface { public function hasViewBuilderClass(); /** - * Returns the access class. + * Returns the access control class. * * @return string - * The class for this entity type's access. + * The class for this entity type's access control. */ - public function getAccessClass(); + public function getAccessControlClass(); /** * Returns the access class. @@ -363,7 +363,7 @@ interface EntityTypeInterface { /** * Returns the name of the default administrative permission. * - * The default \Drupal\Core\Entity\EntityAccessController class checks this + * The default \Drupal\Core\Entity\EntityAccessControlHandler class checks this * permission for all operations in its checkAccess() method. Entities with * more complex permissions can extend this class to do their own access * checks. diff --git a/core/lib/Drupal/Core/Field/FieldItemList.php b/core/lib/Drupal/Core/Field/FieldItemList.php index 726572f..7f0890d 100644 --- a/core/lib/Drupal/Core/Field/FieldItemList.php +++ b/core/lib/Drupal/Core/Field/FieldItemList.php @@ -188,8 +188,8 @@ class FieldItemList extends ItemList implements FieldItemListInterface { * {@inheritdoc} */ public function access($operation = 'view', AccountInterface $account = NULL) { - $access_controller = \Drupal::entityManager()->getAccessController($this->getEntity()->getEntityTypeId()); - return $access_controller->fieldAccess($operation, $this->getFieldDefinition(), $account, $this); + $access_control_handler = \Drupal::entityManager()->getAccessControlHandler($this->getEntity()->getEntityTypeId()); + return $access_control_handler->fieldAccess($operation, $this->getFieldDefinition(), $account, $this); } /** diff --git a/core/lib/Drupal/Core/Field/FieldItemListInterface.php b/core/lib/Drupal/Core/Field/FieldItemListInterface.php index ddfe26b..402aa19 100644 --- a/core/lib/Drupal/Core/Field/FieldItemListInterface.php +++ b/core/lib/Drupal/Core/Field/FieldItemListInterface.php @@ -84,7 +84,7 @@ interface FieldItemListInterface extends ListInterface, AccessibleInterface { /** * Contains the default access logic of this field. * - * See \Drupal\Core\Entity\EntityAccessControllerInterface::fieldAccess() for + * See \Drupal\Core\Entity\EntityAccessControlHandlerInterface::fieldAccess() for * the parameter documentation. * * @return bool diff --git a/core/modules/aggregator/src/Entity/Feed.php b/core/modules/aggregator/src/Entity/Feed.php index 542b47c..a01a055 100644 --- a/core/modules/aggregator/src/Entity/Feed.php +++ b/core/modules/aggregator/src/Entity/Feed.php @@ -23,7 +23,7 @@ use Drupal\aggregator\FeedInterface; * controllers = { * "storage" = "Drupal\aggregator\FeedStorage", * "view_builder" = "Drupal\aggregator\FeedViewBuilder", - * "access" = "Drupal\aggregator\FeedAccessController", + * "access" = "Drupal\aggregator\FeedAccessControlHandler", * "form" = { * "default" = "Drupal\aggregator\FeedForm", * "delete" = "Drupal\aggregator\Form\FeedDeleteForm", diff --git a/core/modules/aggregator/src/Entity/Item.php b/core/modules/aggregator/src/Entity/Item.php index f513501..84244b4 100644 --- a/core/modules/aggregator/src/Entity/Item.php +++ b/core/modules/aggregator/src/Entity/Item.php @@ -24,7 +24,7 @@ use Drupal\Core\Url; * controllers = { * "storage" = "Drupal\aggregator\ItemStorage", * "view_builder" = "Drupal\aggregator\ItemViewBuilder", - * "access" = "Drupal\aggregator\FeedAccessController", + * "access" = "Drupal\aggregator\FeedAccessControlHandler", * }, * uri_callback = "Drupal\aggregator\Entity\Item::buildUri", * base_table = "aggregator_item", diff --git a/core/modules/aggregator/src/FeedAccessController.php b/core/modules/aggregator/src/FeedAccessControlHandler.php index 73ad32c..9683ad5 100644 --- a/core/modules/aggregator/src/FeedAccessController.php +++ b/core/modules/aggregator/src/FeedAccessControlHandler.php @@ -2,21 +2,21 @@ /** * @file - * Contains \Drupal\aggregator\FeedAccessController. + * Contains \Drupal\aggregator\FeedAccessControlHandler. */ namespace Drupal\aggregator; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines an access controller for the feed entity. + * Defines an access control handler for the feed entity. * * @see \Drupal\aggregator\Entity\Feed */ -class FeedAccessController extends EntityAccessController { +class FeedAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/block/block.api.php b/core/modules/block/block.api.php index f43d984..a33aaa9 100644 --- a/core/modules/block/block.api.php +++ b/core/modules/block/block.api.php @@ -142,10 +142,10 @@ function hook_block_view_BASE_BLOCK_ID_alter(array &$build, \Drupal\block\BlockP * @return bool|null * FALSE denies access. TRUE allows access unless another module returns * FALSE. If all modules return NULL, then default access rules from - * \Drupal\block\BlockAccessController::checkAccess() are used. + * \Drupal\block\BlockAccessControlHandler::checkAccess() are used. * - * @see \Drupal\Core\Entity\EntityAccessController::access() - * @see \Drupal\block\BlockAccessController::checkAccess() + * @see \Drupal\Core\Entity\EntityAccessControlHandler::access() + * @see \Drupal\block\BlockAccessControlHandler::checkAccess() * @ingroup block_api */ function hook_block_access(\Drupal\block\Entity\Block $block, $operation, \Drupal\user\Entity\User $account, $langcode) { diff --git a/core/modules/block/src/BlockAccessController.php b/core/modules/block/src/BlockAccessControlHandler.php index 0089470..2768d88 100644 --- a/core/modules/block/src/BlockAccessController.php +++ b/core/modules/block/src/BlockAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\block\BlockAccessController. + * Contains \Drupal\block\BlockAccessControlHandler. */ namespace Drupal\block; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Provides a Block access controller. + * Defines the access control handler for the block entity type. + * + * @see \Drupal\block\Entity\Block */ -class BlockAccessController extends EntityAccessController { +class BlockAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/block/src/BlockPluginInterface.php b/core/modules/block/src/BlockPluginInterface.php index 05d0ce5..de13fe8 100644 --- a/core/modules/block/src/BlockPluginInterface.php +++ b/core/modules/block/src/BlockPluginInterface.php @@ -51,7 +51,7 @@ interface BlockPluginInterface extends ConfigurablePluginInterface, PluginFormIn * @return bool * TRUE if the block should be shown, or FALSE otherwise. * - * @see \Drupal\block\BlockAccessController + * @see \Drupal\block\BlockAccessControlHandler */ public function access(AccountInterface $account); diff --git a/core/modules/block/src/Entity/Block.php b/core/modules/block/src/Entity/Block.php index 486afb8..afd5697 100644 --- a/core/modules/block/src/Entity/Block.php +++ b/core/modules/block/src/Entity/Block.php @@ -22,7 +22,7 @@ use Drupal\Core\Entity\EntityStorageInterface; * id = "block", * label = @Translation("Block"), * controllers = { - * "access" = "Drupal\block\BlockAccessController", + * "access" = "Drupal\block\BlockAccessControlHandler", * "view_builder" = "Drupal\block\BlockViewBuilder", * "list_builder" = "Drupal\block\BlockListBuilder", * "form" = { diff --git a/core/modules/block_content/src/BlockContentAccessController.php b/core/modules/block_content/src/BlockContentAccessControlHandler.php index 5709498..6b4de23 100644 --- a/core/modules/block_content/src/BlockContentAccessController.php +++ b/core/modules/block_content/src/BlockContentAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\block_content\BlockContentAccessController. + * Contains \Drupal\block_content\BlockContentAccessControlHandler. */ namespace Drupal\block_content; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Session\AccountInterface; /** - * Defines the access controller for the custom block entity type. + * Defines the access control handler for the custom block entity type. + * + * @see \Drupal\block_content\Entity\BlockContent */ -class BlockContentAccessController extends EntityAccessController { +class BlockContentAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php index bb4190c..c825620 100644 --- a/core/modules/block_content/src/Entity/BlockContent.php +++ b/core/modules/block_content/src/Entity/BlockContent.php @@ -22,7 +22,7 @@ use Drupal\block_content\BlockContentInterface; * bundle_label = @Translation("Custom Block type"), * controllers = { * "storage" = "Drupal\block_content\BlockContentStorage", - * "access" = "Drupal\block_content\BlockContentAccessController", + * "access" = "Drupal\block_content\BlockContentAccessControlHandler", * "list_builder" = "Drupal\block_content\BlockContentListBuilder", * "view_builder" = "Drupal\block_content\BlockContentViewBuilder", * "form" = { diff --git a/core/modules/book/book.module b/core/modules/book/book.module index f98978a..f5ca37f 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -124,8 +124,8 @@ function book_node_links_alter(array &$node_links, NodeInterface $node, array &$ if (isset($node->book['depth'])) { if ($context['view_mode'] == 'full' && node_is_page($node)) { $child_type = \Drupal::config('book.settings')->get('child_type'); - $access_controller = \Drupal::entityManager()->getAccessController('node'); - if (($account->hasPermission('add content to books') || $account->hasPermission('administer book outlines')) && $access_controller->createAccess($child_type) && $node->isPublished() && $node->book['depth'] < BookManager::BOOK_MAX_DEPTH) { + $access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node'); + if (($account->hasPermission('add content to books') || $account->hasPermission('administer book outlines')) && $access_control_handler->createAccess($child_type) && $node->isPublished() && $node->book['depth'] < BookManager::BOOK_MAX_DEPTH) { $links['book_add_child'] = array( 'title' => t('Add child page'), 'href' => 'node/add/' . $child_type, diff --git a/core/modules/comment/src/CommentAccessController.php b/core/modules/comment/src/CommentAccessControlHandler.php index d741d86..77367ab 100644 --- a/core/modules/comment/src/CommentAccessController.php +++ b/core/modules/comment/src/CommentAccessControlHandler.php @@ -2,21 +2,21 @@ /** * @file - * Contains \Drupal\comment\CommentAccessController + * Contains \Drupal\comment\CommentAccessControlHandler. */ namespace Drupal\comment; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Access controller for the comment entity. + * Defines the access control handler for the comment entity type. * - * @see \Drupal\comment\Entity\Comment. + * @see \Drupal\comment\Entity\Comment */ -class CommentAccessController extends EntityAccessController { +class CommentAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php index fbc95b0..3d3c42f 100644 --- a/core/modules/comment/src/Entity/Comment.php +++ b/core/modules/comment/src/Entity/Comment.php @@ -25,7 +25,7 @@ use Drupal\user\UserInterface; * bundle_label = @Translation("Content type"), * controllers = { * "storage" = "Drupal\comment\CommentStorage", - * "access" = "Drupal\comment\CommentAccessController", + * "access" = "Drupal\comment\CommentAccessControlHandler", * "view_builder" = "Drupal\comment\CommentViewBuilder", * "form" = { * "default" = "Drupal\comment\CommentForm", diff --git a/core/modules/config/tests/config_test/src/ConfigTestAccessController.php b/core/modules/config/tests/config_test/src/ConfigTestAccessControlHandler.php index fee7966..0814dd8 100644 --- a/core/modules/config/tests/config_test/src/ConfigTestAccessController.php +++ b/core/modules/config/tests/config_test/src/ConfigTestAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\config_test\ConfigTestAccessController. + * Contains \Drupal\config_test\ConfigTestAccessControlHandler. */ namespace Drupal\config_test; use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; /** - * Defines the access controller for the config_test entity type. + * Defines the access control handler for the config_test entity type. + * + * @see \Drupal\config_test\Entity\ConfigTest */ -class ConfigTestAccessController extends EntityAccessController { +class ConfigTestAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/config/tests/config_test/src/Entity/ConfigTest.php b/core/modules/config/tests/config_test/src/Entity/ConfigTest.php index 646f2c0..36f7a69 100644 --- a/core/modules/config/tests/config_test/src/Entity/ConfigTest.php +++ b/core/modules/config/tests/config_test/src/Entity/ConfigTest.php @@ -25,7 +25,7 @@ use Drupal\Core\Entity\EntityStorageInterface; * "default" = "Drupal\config_test\ConfigTestForm", * "delete" = "Drupal\config_test\Form\ConfigTestDeleteForm" * }, - * "access" = "Drupal\config_test\ConfigTestAccessController" + * "access" = "Drupal\config_test\ConfigTestAccessControlHandler" * }, * config_prefix = "dynamic", * entity_keys = { diff --git a/core/modules/contact/src/CategoryAccessController.php b/core/modules/contact/src/CategoryAccessControlHandler.php index f798d79..87d9f1c 100644 --- a/core/modules/contact/src/CategoryAccessController.php +++ b/core/modules/contact/src/CategoryAccessControlHandler.php @@ -2,21 +2,21 @@ /** * @file - * Contains \Drupal\contact\CategoryAccessController. + * Contains \Drupal\contact\CategoryAccessControlHandler. */ namespace Drupal\contact; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines an access controller for the contact category entity. + * Defines the access control handler for the contact category entity type. * - * @see \Drupal\contact\Entity\Category. + * @see \Drupal\contact\Entity\Category */ -class CategoryAccessController extends EntityAccessController { +class CategoryAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/contact/src/Entity/Category.php b/core/modules/contact/src/Entity/Category.php index 021456d..ec770e4 100644 --- a/core/modules/contact/src/Entity/Category.php +++ b/core/modules/contact/src/Entity/Category.php @@ -19,7 +19,7 @@ use Drupal\contact\CategoryInterface; * id = "contact_category", * label = @Translation("Contact category"), * controllers = { - * "access" = "Drupal\contact\CategoryAccessController", + * "access" = "Drupal\contact\CategoryAccessControlHandler", * "list_builder" = "Drupal\contact\CategoryListBuilder", * "form" = { * "add" = "Drupal\contact\CategoryForm", diff --git a/core/modules/content_translation/src/ContentTranslationHandler.php b/core/modules/content_translation/src/ContentTranslationHandler.php index b1b7cc0..d2267de 100644 --- a/core/modules/content_translation/src/ContentTranslationHandler.php +++ b/core/modules/content_translation/src/ContentTranslationHandler.php @@ -60,7 +60,7 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface { * {@inheritdoc} */ public function getTranslationAccess(EntityInterface $entity, $op) { - // @todo Move this logic into a translation access controller checking also + // @todo Move this logic into a translation access control handler checking also // the translation language and the given account. $entity_type = $entity->getEntityType(); $translate_permission = TRUE; diff --git a/core/modules/entity_reference/src/EntityReferenceController.php b/core/modules/entity_reference/src/EntityReferenceController.php index 2383ba6..026b5d5 100644 --- a/core/modules/entity_reference/src/EntityReferenceController.php +++ b/core/modules/entity_reference/src/EntityReferenceController.php @@ -78,8 +78,8 @@ class EntityReferenceController extends ControllerBase { } $field_definition = $definitions[$field_name]; - $access_controller = $this->entityManager()->getAccessController($entity_type); - if ($field_definition->getType() != 'entity_reference' || !$access_controller->fieldAccess('edit', $field_definition)) { + $access_control_handler = $this->entityManager()->getAccessControlHandler($entity_type); + if ($field_definition->getType() != 'entity_reference' || !$access_control_handler->fieldAccess('edit', $field_definition)) { throw new AccessDeniedHttpException(); } diff --git a/core/modules/field/src/Entity/FieldInstanceConfig.php b/core/modules/field/src/Entity/FieldInstanceConfig.php index 2b8fac0..fb39fca 100644 --- a/core/modules/field/src/Entity/FieldInstanceConfig.php +++ b/core/modules/field/src/Entity/FieldInstanceConfig.php @@ -24,7 +24,7 @@ use Drupal\field\FieldInstanceConfigInterface; * id = "field_instance_config", * label = @Translation("Field instance"), * controllers = { - * "access" = "Drupal\field\FieldInstanceConfigAccessController", + * "access" = "Drupal\field\FieldInstanceConfigAccessControlHandler", * "storage" = "Drupal\field\FieldInstanceConfigStorage" * }, * config_prefix = "instance", diff --git a/core/modules/field/src/FieldInstanceConfigAccessController.php b/core/modules/field/src/FieldInstanceConfigAccessControlHandler.php index 1146e1b..6b21783 100644 --- a/core/modules/field/src/FieldInstanceConfigAccessController.php +++ b/core/modules/field/src/FieldInstanceConfigAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\field\FieldInstanceConfigAccessController. + * Contains \Drupal\field\FieldInstanceConfigAccessControlHandler. */ namespace Drupal\field; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines the access controller for the field instance entity type. + * Defines the access control handler for the field instance entity type. + * + * @see \Drupal\field\Entity\FieldInstanceConfig */ -class FieldInstanceConfigAccessController extends EntityAccessController { +class FieldInstanceConfigAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/field/src/Plugin/views/field/Field.php b/core/modules/field/src/Plugin/views/field/Field.php index e4103f3..b7280bd 100644 --- a/core/modules/field/src/Plugin/views/field/Field.php +++ b/core/modules/field/src/Plugin/views/field/Field.php @@ -213,8 +213,8 @@ class Field extends FieldPluginBase { */ public function access(AccountInterface $account) { $base_table = $this->get_base_table(); - $access_controller = $this->entityManager->getAccessController($this->definition['entity_tables'][$base_table]); - return $access_controller->fieldAccess('view', $this->getFieldDefinition(), $account); + $access_control_handler = $this->entityManager->getAccessControlHandler($this->definition['entity_tables'][$base_table]); + return $access_control_handler->fieldAccess('view', $this->getFieldDefinition(), $account); } /** diff --git a/core/modules/file/src/Entity/File.php b/core/modules/file/src/Entity/File.php index 59a5421..8f2bb27 100644 --- a/core/modules/file/src/Entity/File.php +++ b/core/modules/file/src/Entity/File.php @@ -23,7 +23,7 @@ use Drupal\user\UserInterface; * label = @Translation("File"), * controllers = { * "storage" = "Drupal\file\FileStorage", - * "access" = "Drupal\file\FileAccessController", + * "access" = "Drupal\file\FileAccessControlHandler", * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder" * }, * base_table = "file_managed", diff --git a/core/modules/file/src/FileAccessController.php b/core/modules/file/src/FileAccessControlHandler.php index 08972ab..ee62c22 100644 --- a/core/modules/file/src/FileAccessController.php +++ b/core/modules/file/src/FileAccessControlHandler.php @@ -2,20 +2,20 @@ /** * @file - * Contains \Drupal\file\FileAccessController. + * Contains \Drupal\file\FileAccessControlHandler. */ namespace Drupal\file; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Session\AccountInterface; /** - * Provides a File access controller. + * Provides a File access control handler. */ -class FileAccessController extends EntityAccessController { +class FileAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/filter/src/Entity/FilterFormat.php b/core/modules/filter/src/Entity/FilterFormat.php index c8c1942..2e68bba 100644 --- a/core/modules/filter/src/Entity/FilterFormat.php +++ b/core/modules/filter/src/Entity/FilterFormat.php @@ -27,7 +27,7 @@ use Drupal\filter\Plugin\FilterInterface; * "disable" = "Drupal\filter\Form\FilterDisableForm" * }, * "list_builder" = "Drupal\filter\FilterFormatListBuilder", - * "access" = "Drupal\filter\FilterFormatAccess", + * "access" = "Drupal\filter\FilterFormatAccessControlHandler", * }, * config_prefix = "format", * admin_permission = "administer filters", diff --git a/core/modules/filter/src/FilterFormatAccess.php b/core/modules/filter/src/FilterFormatAccessControlHandler.php index b6f6f58..1a876b9 100644 --- a/core/modules/filter/src/FilterFormatAccess.php +++ b/core/modules/filter/src/FilterFormatAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\filter\FilterFormatAccess. + * Contains \Drupal\filter\FilterFormatAccessControlHandler. */ namespace Drupal\filter; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines the access controller for the filter format entity type. + * Defines the access control handler for the filter format entity type. + * + * @see \Drupal\filter\Entity\FilterFormat */ -class FilterFormatAccess extends EntityAccessController { +class FilterFormatAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 51b98a6..d30c85b 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -114,7 +114,7 @@ function forum_menu_local_tasks(&$data, $route_name) { // Loop through all bundles for forum taxonomy vocabulary field. $field_map = \Drupal::entityManager()->getFieldMap(); foreach ($field_map['node']['taxonomy_forums']['bundles'] as $type) { - if (\Drupal::entityManager()->getAccessController('node')->createAccess($type)) { + if (\Drupal::entityManager()->getAccessControlHandler('node')->createAccess($type)) { $links[$type] = array( '#theme' => 'menu_local_action', '#link' => array( diff --git a/core/modules/language/src/Entity/Language.php b/core/modules/language/src/Entity/Language.php index 123fb7c..d80a735 100644 --- a/core/modules/language/src/Entity/Language.php +++ b/core/modules/language/src/Entity/Language.php @@ -22,7 +22,7 @@ use Drupal\language\LanguageInterface; * label = @Translation("Language"), * controllers = { * "list_builder" = "Drupal\language\LanguageListBuilder", - * "access" = "Drupal\language\LanguageAccessController", + * "access" = "Drupal\language\LanguageAccessControlHandler", * "form" = { * "add" = "Drupal\language\Form\LanguageAddForm", * "edit" = "Drupal\language\Form\LanguageEditForm", diff --git a/core/modules/language/src/LanguageAccessController.php b/core/modules/language/src/LanguageAccessControlHandler.php index 5ebded0..4adb778 100644 --- a/core/modules/language/src/LanguageAccessController.php +++ b/core/modules/language/src/LanguageAccessControlHandler.php @@ -2,16 +2,21 @@ /** * @file - * Contains \Drupal\language\LanguageAccessController. + * Contains \Drupal\language\LanguageAccessControlHandler. */ namespace Drupal\language; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; -class LanguageAccessController extends EntityAccessController { +/** + * Defines the access control handler for the language entity type. + * + * @see \Drupal\language\Entity\Language + */ +class LanguageAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php index d89005b..ae57007 100644 --- a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php +++ b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php @@ -22,7 +22,7 @@ use Drupal\menu_link_content\MenuLinkContentInterface; * label = @Translation("Custom menu link"), * controllers = { * "storage" = "Drupal\Core\Entity\ContentEntityDatabaseStorage", - * "access" = "Drupal\menu_link_content\MenuLinkContentAccessController", + * "access" = "Drupal\menu_link_content\MenuLinkContentAccessControlHandler", * "form" = { * "default" = "Drupal\menu_link_content\Form\MenuLinkContentForm", * "delete" = "Drupal\menu_link_content\Form\MenuLinkContentDeleteForm" diff --git a/core/modules/menu_link_content/src/MenuLinkContentAccessController.php b/core/modules/menu_link_content/src/MenuLinkContentAccessControlHandler.php index ad36c19..e2d43c7 100644 --- a/core/modules/menu_link_content/src/MenuLinkContentAccessController.php +++ b/core/modules/menu_link_content/src/MenuLinkContentAccessControlHandler.php @@ -1,23 +1,23 @@ <?php /** * @file - * Contains \Drupal\menu_link_content\MenuLinkContentAccessController. + * Contains \Drupal\menu_link_content\MenuLinkContentAccessControlHandler. */ namespace Drupal\menu_link_content; use Drupal\Core\Access\AccessManagerInterface; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityControllerInterface; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityAccessController; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Defines the access controller for the user entity type. + * Defines the access control handler for the user entity type. */ -class MenuLinkContentAccessController extends EntityAccessController implements EntityControllerInterface { +class MenuLinkContentAccessControlHandler extends EntityAccessControlHandler implements EntityControllerInterface { /** * The access manager to check routes by name. @@ -27,7 +27,7 @@ class MenuLinkContentAccessController extends EntityAccessController implements protected $accessManager; /** - * Creates a new MenuLinkContentAccessController. + * Creates a new MenuLinkContentAccessControlHandler. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type definition. diff --git a/core/modules/node/node.install b/core/modules/node/node.install index 7df16df..4082a49 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -18,7 +18,7 @@ function node_requirements($phase) { // Only show rebuild button if there are either 0, or 2 or more, rows // in the {node_access} table, or if there are modules that // implement hook_node_grants(). - $grant_count = \Drupal::entityManager()->getAccessController('node')->countGrants(); + $grant_count = \Drupal::entityManager()->getAccessControlHandler('node')->countGrants(); if ($grant_count != 1 || count(\Drupal::moduleHandler()->getImplementations('node_grants')) > 0) { $value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count)); } diff --git a/core/modules/node/node.module b/core/modules/node/node.module index fdec8ba..ff88125 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1111,7 +1111,7 @@ function node_form_system_themes_admin_form_submit($form, FormStateInterface $fo * @{ * The node access system determines who can do what to which nodes. * - * In determining access rights for a node, \Drupal\node\NodeAccessController + * In determining access rights for a node, \Drupal\node\NodeAccessControlHandler * first checks whether the user has the "bypass node access" permission. Such * users have unrestricted access to all nodes. user 1 will always pass this * check. @@ -1315,7 +1315,7 @@ function node_access_view_all_nodes($account = NULL) { $access[$account->id()] = TRUE; } else { - $access[$account->id()] = \Drupal::entityManager()->getAccessController('node')->checkAllGrants($account); + $access[$account->id()] = \Drupal::entityManager()->getAccessControlHandler('node')->checkAllGrants($account); } return $access[$account->id()]; @@ -1439,8 +1439,8 @@ function node_access_needs_rebuild($rebuild = NULL) { * @see node_access_needs_rebuild() */ function node_access_rebuild($batch_mode = FALSE) { - $access_controller = \Drupal::entityManager()->getAccessController('node'); - $access_controller->deleteGrants(); + $access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node'); + $access_control_handler->deleteGrants(); // Only recalculate if the site is using a node_access module. if (count(\Drupal::moduleHandler()->getImplementations('node_grants'))) { if ($batch_mode) { @@ -1467,14 +1467,14 @@ function node_access_rebuild($batch_mode = FALSE) { // To preserve database integrity, only write grants if the node // loads successfully. if (!empty($node)) { - $access_controller->writeGrants($node); + $access_control_handler->writeGrants($node); } } } } else { // Not using any node_access modules. Add the default grant. - $access_controller->writeDefaultGrant(); + $access_control_handler->writeDefaultGrant(); } if (!isset($batch)) { @@ -1513,7 +1513,7 @@ function _node_access_rebuild_batch_operation(&$context) { // To preserve database integrity, only write grants if the node // loads successfully. if (!empty($node)) { - \Drupal::entityManager()->getAccessController('node')->writeGrants($node); + \Drupal::entityManager()->getAccessControlHandler('node')->writeGrants($node); } $context['sandbox']['progress']++; $context['sandbox']['current_node'] = $nid; diff --git a/core/modules/node/src/Access/NodeAddAccessCheck.php b/core/modules/node/src/Access/NodeAddAccessCheck.php index c7bb0e7..3813f9f 100644 --- a/core/modules/node/src/Access/NodeAddAccessCheck.php +++ b/core/modules/node/src/Access/NodeAddAccessCheck.php @@ -47,14 +47,14 @@ class NodeAddAccessCheck implements AccessInterface { * A \Drupal\Core\Access\AccessInterface constant value. */ public function access(AccountInterface $account, NodeTypeInterface $node_type = NULL) { - $access_controller = $this->entityManager->getAccessController('node'); + $access_control_handler = $this->entityManager->getAccessControlHandler('node'); // If checking whether a node of a particular type may be created. if ($node_type) { - return $access_controller->createAccess($node_type->id(), $account) ? static::ALLOW : static::DENY; + return $access_control_handler->createAccess($node_type->id(), $account) ? static::ALLOW : static::DENY; } // If checking whether a node of any type may be created. foreach (node_permissions_get_configured_types() as $node_type) { - if ($access_controller->createAccess($node_type->id(), $account)) { + if ($access_control_handler->createAccess($node_type->id(), $account)) { return static::ALLOW; } } diff --git a/core/modules/node/src/Access/NodeRevisionAccessCheck.php b/core/modules/node/src/Access/NodeRevisionAccessCheck.php index 66dc7e2..3801e36 100644 --- a/core/modules/node/src/Access/NodeRevisionAccessCheck.php +++ b/core/modules/node/src/Access/NodeRevisionAccessCheck.php @@ -27,9 +27,9 @@ class NodeRevisionAccessCheck implements AccessInterface { protected $nodeStorage; /** - * The node access controller. + * The node access control handler. * - * @var \Drupal\Core\Entity\EntityAccessControllerInterface + * @var \Drupal\Core\Entity\EntityAccessControlHandlerInterface */ protected $nodeAccess; @@ -57,7 +57,7 @@ class NodeRevisionAccessCheck implements AccessInterface { */ public function __construct(EntityManagerInterface $entity_manager, Connection $connection) { $this->nodeStorage = $entity_manager->getStorage('node'); - $this->nodeAccess = $entity_manager->getAccessController('node'); + $this->nodeAccess = $entity_manager->getAccessControlHandler('node'); $this->connection = $connection; } diff --git a/core/modules/node/src/Controller/NodeController.php b/core/modules/node/src/Controller/NodeController.php index d98ec00..e40cf7e 100644 --- a/core/modules/node/src/Controller/NodeController.php +++ b/core/modules/node/src/Controller/NodeController.php @@ -64,7 +64,7 @@ class NodeController extends ControllerBase implements ContainerInjectionInterfa // Only use node types the user has access to. foreach ($this->entityManager()->getStorage('node_type')->loadMultiple() as $type) { - if ($this->entityManager()->getAccessController('node')->createAccess($type->type)) { + if ($this->entityManager()->getAccessControlHandler('node')->createAccess($type->type)) { $content[$type->type] = $type; } } diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php index 19f311e..b9d5a53 100644 --- a/core/modules/node/src/Entity/Node.php +++ b/core/modules/node/src/Entity/Node.php @@ -26,7 +26,7 @@ use Drupal\user\UserInterface; * controllers = { * "storage" = "Drupal\node\NodeStorage", * "view_builder" = "Drupal\node\NodeViewBuilder", - * "access" = "Drupal\node\NodeAccessController", + * "access" = "Drupal\node\NodeAccessControlHandler", * "form" = { * "default" = "Drupal\node\NodeForm", * "delete" = "Drupal\node\Form\NodeDeleteForm", @@ -103,7 +103,7 @@ class Node extends ContentEntityBase implements NodeInterface { // default revision. There's no need to delete existing records if the node // is new. if ($this->isDefaultRevision()) { - \Drupal::entityManager()->getAccessController('node')->writeGrants($this, $update); + \Drupal::entityManager()->getAccessControlHandler('node')->writeGrants($this, $update); } // Reindex the node when it is updated. The node is automatically indexed @@ -151,7 +151,7 @@ class Node extends ContentEntityBase implements NodeInterface { } return \Drupal::entityManager() - ->getAccessController($this->entityTypeId) + ->getAccessControlHandler($this->entityTypeId) ->access($this, $operation, $this->prepareLangcode(), $account); } diff --git a/core/modules/node/src/Entity/NodeType.php b/core/modules/node/src/Entity/NodeType.php index ecc21ea..91ce4f7 100644 --- a/core/modules/node/src/Entity/NodeType.php +++ b/core/modules/node/src/Entity/NodeType.php @@ -19,7 +19,7 @@ use Drupal\node\NodeTypeInterface; * id = "node_type", * label = @Translation("Content type"), * controllers = { - * "access" = "Drupal\node\NodeTypeAccessController", + * "access" = "Drupal\node\NodeTypeAccessControlHandler", * "form" = { * "add" = "Drupal\node\NodeTypeForm", * "edit" = "Drupal\node\NodeTypeForm", diff --git a/core/modules/node/src/NodeAccessController.php b/core/modules/node/src/NodeAccessControlHandler.php index ab38a26..e6a8ce7 100644 --- a/core/modules/node/src/NodeAccessController.php +++ b/core/modules/node/src/NodeAccessControlHandler.php @@ -2,27 +2,25 @@ /** * @file - * Contains \Drupal\node\NodeAccessController. + * Contains \Drupal\node\NodeAccessControlHandler. */ namespace Drupal\node; -use Drupal\Core\Database\Connection; -use Drupal\Core\Database\Query\SelectInterface; use Drupal\Core\Entity\EntityControllerInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Language\LanguageInterface; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Session\AccountInterface; -use Drupal\user\Entity\User; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Defines the access controller for the node entity type. + * Defines the access control handler for the node entity type. + * + * @see \Drupal\node\Entity\Node */ -class NodeAccessController extends EntityAccessController implements NodeAccessControllerInterface, EntityControllerInterface { +class NodeAccessControlHandler extends EntityAccessControlHandler implements NodeAccessControlHandlerInterface, EntityControllerInterface { /** * The node grant storage. @@ -32,7 +30,7 @@ class NodeAccessController extends EntityAccessController implements NodeAccessC protected $grantStorage; /** - * Constructs a NodeAccessController object. + * Constructs a NodeAccessControlHandler object. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type definition. diff --git a/core/modules/node/src/NodeAccessControllerInterface.php b/core/modules/node/src/NodeAccessControlHandlerInterface.php index 368f7bf..cb395d0 100644 --- a/core/modules/node/src/NodeAccessControllerInterface.php +++ b/core/modules/node/src/NodeAccessControlHandlerInterface.php @@ -1,14 +1,17 @@ <?php /** * @file - * Contains + * Contains \Drupal\node\NodeAccessControlHandlerInterface. */ namespace Drupal\node; use Drupal\Core\Session\AccountInterface; -interface NodeAccessControllerInterface { +/** + * Node specific entity access control methods. + */ +interface NodeAccessControlHandlerInterface { /** * Gets the list of node access grants. diff --git a/core/modules/node/src/NodeGrantDatabaseStorage.php b/core/modules/node/src/NodeGrantDatabaseStorage.php index 9503713..a47a7d9 100644 --- a/core/modules/node/src/NodeGrantDatabaseStorage.php +++ b/core/modules/node/src/NodeGrantDatabaseStorage.php @@ -38,7 +38,7 @@ class NodeGrantDatabaseStorage implements NodeGrantDatabaseStorageInterface { protected $moduleHandler; /** - * Constructs a NodeAccessController object. + * Constructs a NodeGrantDatabaseStorage object. * * @param \Drupal\Core\Database\Connection $database * The database connection. diff --git a/core/modules/node/src/NodeGrantDatabaseStorageInterface.php b/core/modules/node/src/NodeGrantDatabaseStorageInterface.php index c67025b..54c31ef 100644 --- a/core/modules/node/src/NodeGrantDatabaseStorageInterface.php +++ b/core/modules/node/src/NodeGrantDatabaseStorageInterface.php @@ -10,7 +10,7 @@ namespace Drupal\node; use Drupal\Core\Session\AccountInterface; /** - * Provides an interface for node access controllers. + * Provides an interface for node access grant storage. */ interface NodeGrantDatabaseStorageInterface { diff --git a/core/modules/node/src/NodeTypeAccessController.php b/core/modules/node/src/NodeTypeAccessControlHandler.php index 23ec80f..e3dc594 100644 --- a/core/modules/node/src/NodeTypeAccessController.php +++ b/core/modules/node/src/NodeTypeAccessControlHandler.php @@ -2,21 +2,21 @@ /** * @file - * Contains \Drupal\taxonomy\NodeTypeAccessController. + * Contains \Drupal\taxonomy\NodeTypeAccessControlHandler. */ namespace Drupal\node; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines an access controller for the node type entity. + * Defines the access control handler for the node type entity type. * - * @see \Drupal\node\Entity\NodeType. + * @see \Drupal\node\Entity\NodeType */ -class NodeTypeAccessController extends EntityAccessController { +class NodeTypeAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/node/src/Tests/NodeAccessLanguageTest.php b/core/modules/node/src/Tests/NodeAccessLanguageTest.php index 9683cca..29ef472 100644 --- a/core/modules/node/src/Tests/NodeAccessLanguageTest.php +++ b/core/modules/node/src/Tests/NodeAccessLanguageTest.php @@ -95,7 +95,7 @@ class NodeAccessLanguageTest extends NodeTestBase { $this->assertNodeAccess($expected_node_access_no_access, $node_public_no_language, $web_user, 'hr'); // Reset the node access cache and turn on our test node access code. - \Drupal::entityManager()->getAccessController('node')->resetCache(); + \Drupal::entityManager()->getAccessControlHandler('node')->resetCache(); \Drupal::state()->set('node_access_test_secret_catalan', 1); $node_public_ca = $this->drupalCreateNode(array('body' => array(array()), 'langcode' => 'ca', 'private' => FALSE)); $this->assertTrue($node_public_ca->language()->id == 'ca', 'Node created as Catalan.'); @@ -122,7 +122,7 @@ class NodeAccessLanguageTest extends NodeTestBase { // static cache has not been reset. $this->assertNodeAccess($expected_node_access_no_access, $node_public_ca, $web_user, 'ca'); - \Drupal::entityManager()->getAccessController('node')->resetCache(); + \Drupal::entityManager()->getAccessControlHandler('node')->resetCache(); // Tests that access is granted if requested with no language. $this->assertNodeAccess($expected_node_access, $node_public_no_language, $web_user); @@ -185,7 +185,7 @@ class NodeAccessLanguageTest extends NodeTestBase { $this->assertNodeAccess($expected_node_access_no_access, $node_private_no_language, $web_user, 'hr'); // Reset the node access cache and turn on our test node access code. - \Drupal::entityManager()->getAccessController('node')->resetCache(); + \Drupal::entityManager()->getAccessControlHandler('node')->resetCache(); \Drupal::state()->set('node_access_test_secret_catalan', 1); // Tests that access is not granted if requested with no language. @@ -207,7 +207,7 @@ class NodeAccessLanguageTest extends NodeTestBase { $this->assertNodeAccess($expected_node_access_no_access, $node_private_ca, $web_user, 'ca'); $this->assertNodeAccess($expected_node_access_no_access, $node_private_ca, $private_ca_user, 'ca'); - \Drupal::entityManager()->getAccessController('node')->resetCache(); + \Drupal::entityManager()->getAccessControlHandler('node')->resetCache(); \Drupal::state()->set('node_access_test_secret_catalan', 0); // Tests that Catalan is still not accessible for a user with no access to diff --git a/core/modules/node/src/Tests/NodeTestBase.php b/core/modules/node/src/Tests/NodeTestBase.php index dcb0518..2e55bf3 100644 --- a/core/modules/node/src/Tests/NodeTestBase.php +++ b/core/modules/node/src/Tests/NodeTestBase.php @@ -23,11 +23,11 @@ abstract class NodeTestBase extends WebTestBase { public static $modules = array('node', 'datetime'); /** - * The node access controller. + * The node access control handler. * - * @var \Drupal\Core\Entity\EntityAccessControllerInterface + * @var \Drupal\Core\Entity\EntityAccessControlHandlerInterface */ - protected $accessController; + protected $accessHandler; function setUp() { parent::setUp(); @@ -43,7 +43,7 @@ abstract class NodeTestBase extends WebTestBase { ))); $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); } - $this->accessController = \Drupal::entityManager()->getAccessController('node'); + $this->accessHandler = \Drupal::entityManager()->getAccessControlHandler('node'); } /** @@ -67,7 +67,7 @@ abstract class NodeTestBase extends WebTestBase { if (empty($langcode)) { $langcode = $node->prepareLangcode(); } - $this->assertEqual($result, $this->accessController->access($node, $op, $langcode, $account), $this->nodeAccessAssertMessage($op, $result, $langcode)); + $this->assertEqual($result, $this->accessHandler->access($node, $op, $langcode, $account), $this->nodeAccessAssertMessage($op, $result, $langcode)); } } @@ -85,7 +85,7 @@ abstract class NodeTestBase extends WebTestBase { * to check. If NULL, the untranslated (fallback) access is checked. */ function assertNodeCreateAccess($bundle, $result, AccountInterface $account, $langcode = NULL) { - $this->assertEqual($result, $this->accessController->createAccess($bundle, $account, array( + $this->assertEqual($result, $this->accessHandler->createAccess($bundle, $account, array( 'langcode' => $langcode, )), $this->nodeAccessAssertMessage('create', $result, $langcode)); } diff --git a/core/modules/search/src/Entity/SearchPage.php b/core/modules/search/src/Entity/SearchPage.php index b46c737..4d15e55 100644 --- a/core/modules/search/src/Entity/SearchPage.php +++ b/core/modules/search/src/Entity/SearchPage.php @@ -23,7 +23,7 @@ use Drupal\search\SearchPageInterface; * id = "search_page", * label = @Translation("Search page"), * controllers = { - * "access" = "Drupal\search\SearchPageAccessController", + * "access" = "Drupal\search\SearchPageAccessControlHandler", * "storage" = "Drupal\Core\Config\Entity\ConfigEntityStorage", * "list_builder" = "Drupal\search\SearchPageListBuilder", * "form" = { diff --git a/core/modules/search/src/SearchPageAccessController.php b/core/modules/search/src/SearchPageAccessControlHandler.php index cd51278..65723b6 100644 --- a/core/modules/search/src/SearchPageAccessController.php +++ b/core/modules/search/src/SearchPageAccessControlHandler.php @@ -2,20 +2,22 @@ /** * @file - * Contains \Drupal\search\SearchPageAccessController. + * Contains \Drupal\search\SearchPageAccessControlHandler. */ namespace Drupal\search; use Drupal\Core\Access\AccessibleInterface; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines the access controller for the search page entity type. + * Defines the access control handler for the search page entity type. + * + * @see \Drupal\search\Entity\SearchPage */ -class SearchPageAccessController extends EntityAccessController { +class SearchPageAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/shortcut/src/Entity/Shortcut.php b/core/modules/shortcut/src/Entity/Shortcut.php index 4fd0ce6..bec4cb6 100644 --- a/core/modules/shortcut/src/Entity/Shortcut.php +++ b/core/modules/shortcut/src/Entity/Shortcut.php @@ -22,7 +22,7 @@ use Drupal\shortcut\ShortcutInterface; * id = "shortcut", * label = @Translation("Shortcut link"), * controllers = { - * "access" = "Drupal\shortcut\ShortcutAccessController", + * "access" = "Drupal\shortcut\ShortcutAccessControlHandler", * "form" = { * "default" = "Drupal\shortcut\ShortcutForm", * "add" = "Drupal\shortcut\ShortcutForm", diff --git a/core/modules/shortcut/src/Entity/ShortcutSet.php b/core/modules/shortcut/src/Entity/ShortcutSet.php index 473809b..5957961 100644 --- a/core/modules/shortcut/src/Entity/ShortcutSet.php +++ b/core/modules/shortcut/src/Entity/ShortcutSet.php @@ -19,7 +19,7 @@ use Drupal\shortcut\ShortcutSetInterface; * label = @Translation("Shortcut set"), * controllers = { * "storage" = "Drupal\shortcut\ShortcutSetStorage", - * "access" = "Drupal\shortcut\ShortcutSetAccessController", + * "access" = "Drupal\shortcut\ShortcutSetAccessControlHandler", * "list_builder" = "Drupal\shortcut\ShortcutSetListBuilder", * "form" = { * "default" = "Drupal\shortcut\ShortcutSetForm", diff --git a/core/modules/shortcut/src/ShortcutAccessController.php b/core/modules/shortcut/src/ShortcutAccessControlHandler.php index b76d48b..c08f096 100644 --- a/core/modules/shortcut/src/ShortcutAccessController.php +++ b/core/modules/shortcut/src/ShortcutAccessControlHandler.php @@ -2,12 +2,12 @@ /** * @file - * Contains \Drupal\shortcut\ShortcutAccessController. + * Contains \Drupal\shortcut\ShortcutAccessControlHandler. */ namespace Drupal\shortcut; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityControllerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -15,9 +15,11 @@ use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Defines the access controller for the test entity type. + * Defines the access control handler for the shortcut entity type. + * + * @see \Drupal\shortcut\Entity\Shortcut */ -class ShortcutAccessController extends EntityAccessController implements EntityControllerInterface { +class ShortcutAccessControlHandler extends EntityAccessControlHandler implements EntityControllerInterface { /** * The shortcut_set storage. @@ -27,7 +29,7 @@ class ShortcutAccessController extends EntityAccessController implements EntityC protected $shortcutSetStorage; /** - * Constructs a ShortcutAccessController object. + * Constructs a ShortcutAccessControlHandler object. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type definition. diff --git a/core/modules/shortcut/src/ShortcutSetAccessController.php b/core/modules/shortcut/src/ShortcutSetAccessControlHandler.php index cb49a4a..b6ca7c6 100644 --- a/core/modules/shortcut/src/ShortcutSetAccessController.php +++ b/core/modules/shortcut/src/ShortcutSetAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\shortcut\ShortcutSetAccessController. + * Contains \Drupal\shortcut\ShortcutSetAccessControlHandler. */ namespace Drupal\shortcut; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Session\AccountInterface; /** - * Defines the access controller for the shortcut entity type. + * Defines the access control handler for the shortcut set entity type. + * + * @see \Drupal\shortcut\Entity\ShortcutSet */ -class ShortcutSetAccessController extends EntityAccessController { +class ShortcutSetAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/system/core.api.php b/core/modules/system/core.api.php index 887a386..d869360 100644 --- a/core/modules/system/core.api.php +++ b/core/modules/system/core.api.php @@ -565,8 +565,9 @@ * to check access. See the @link menu Routing topic @endlink for more * information. * - Entities: Access for various entity operations is designated either with - * simple permissions or access controller classes in the entity annotation. - * See the @link entity_api Entity API topic @endlink for more information. + * simple permissions or access control handler classes in the entity + * annotation. See the @link entity_api Entity API topic @endlink for more + * information. * - Other code: There is a 'current_user' service, which can be injected into * classes to provide access to the current user account (see the * @link container Services and Dependency Injection topic @endlink for more diff --git a/core/modules/system/entity.api.php b/core/modules/system/entity.api.php index b4f7492..e80f34e 100644 --- a/core/modules/system/entity.api.php +++ b/core/modules/system/entity.api.php @@ -299,10 +299,10 @@ use Drupal\Core\Render\Element; * the content. Configuration translation is handled automatically by the * Configuration Translation module, without the need of a controller class. * - access: If your configuration entity has complex permissions, you might - * need an access controller, implementing - * \Drupal\Core\Entity\EntityAccessControllerInterface, but most entities + * need an access control handling, implementing + * \Drupal\Core\Entity\EntityAccessControlHandlerInterface, but most entities * can just use the 'admin_permission' annotation instead. Note that if you - * are creating your own access controller, you should override the + * are creating your own access control handler, you should override the * checkAccess() and checkCreateAccess() methods, not access(). * - storage: A class implementing * \Drupal\Core\Entity\EntityStorageInterface. If not specified, content @@ -478,7 +478,7 @@ use Drupal\Core\Render\Element; * The interface related to access checking in entities and fields is * \Drupal\Core\Access\AccessibleInterface. * - * The default entity access controller invokes two hooks while checking + * The default entity access control handler invokes two hooks while checking * access on a single entity: hook_entity_access() is invoked first, and * then hook_ENTITY_TYPE_access() (where ENTITY_TYPE is the machine name * of the entity type). If no module returns a TRUE or FALSE value from @@ -517,7 +517,7 @@ use Drupal\Core\Render\Element; * A boolean to explicitly allow or deny access, or NULL to neither allow nor * deny access. * - * @see \Drupal\Core\Entity\EntityAccessController + * @see \Drupal\Core\Entity\EntityAccessControlHandler * @see hook_entity_create_access() * @see hook_ENTITY_TYPE_access() * @@ -543,7 +543,7 @@ function hook_entity_access(\Drupal\Core\Entity\EntityInterface $entity, $operat * A boolean to explicitly allow or deny access, or NULL to neither allow nor * deny access. * - * @see \Drupal\Core\Entity\EntityAccessController + * @see \Drupal\Core\Entity\EntityAccessControlHandler * @see hook_ENTITY_TYPE_create_access() * @see hook_entity_access() * @@ -565,7 +565,7 @@ function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $o * A boolean to explicitly allow or deny access, or NULL to neither allow nor * deny access. * - * @see \Drupal\Core\Entity\EntityAccessController + * @see \Drupal\Core\Entity\EntityAccessControlHandler * @see hook_entity_access() * @see hook_ENTITY_TYPE_create_access() * @@ -587,7 +587,7 @@ function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $accoun * A boolean to explicitly allow or deny access, or NULL to neither allow nor * deny access. * - * @see \Drupal\Core\Entity\EntityAccessController + * @see \Drupal\Core\Entity\EntityAccessControlHandler * @see hook_ENTITY_TYPE_access() * @see hook_entity_create_access() * @@ -1799,7 +1799,7 @@ function hook_entity_operation_alter(array &$operations, \Drupal\Core\Entity\Ent * Control access to fields. * * This hook is invoked from - * \Drupal\Core\Entity\EntityAccessController::fieldAccess() to let modules + * \Drupal\Core\Entity\EntityAccessControlHandler::fieldAccess() to let modules * grant or deny operations on fields. * * @param string $operation diff --git a/core/modules/system/src/DateFormatAccessController.php b/core/modules/system/src/DateFormatAccessControlHandler.php index a5483b6..943b678 100644 --- a/core/modules/system/src/DateFormatAccessController.php +++ b/core/modules/system/src/DateFormatAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\system\DateFormatAccessController. + * Contains \Drupal\system\DateFormatAccessControlHandler. */ namespace Drupal\system; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Provides an access controller for date formats. + * Defines the access control handler for the date format entity type. + * + * @see \Drupal\system\Entity\DateFormat */ -class DateFormatAccessController extends EntityAccessController { +class DateFormatAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/system/src/Entity/DateFormat.php b/core/modules/system/src/Entity/DateFormat.php index 2a0cce6..774eb3c 100644 --- a/core/modules/system/src/Entity/DateFormat.php +++ b/core/modules/system/src/Entity/DateFormat.php @@ -19,7 +19,7 @@ use Drupal\system\DateFormatInterface; * id = "date_format", * label = @Translation("Date format"), * controllers = { - * "access" = "Drupal\system\DateFormatAccessController", + * "access" = "Drupal\system\DateFormatAccessControlHandler", * "list_builder" = "Drupal\system\DateFormatListBuilder", * "form" = { * "add" = "Drupal\system\Form\DateFormatAddForm", diff --git a/core/modules/system/src/Entity/Menu.php b/core/modules/system/src/Entity/Menu.php index 756728f..a1848bb 100644 --- a/core/modules/system/src/Entity/Menu.php +++ b/core/modules/system/src/Entity/Menu.php @@ -18,7 +18,7 @@ use Drupal\system\MenuInterface; * id = "menu", * label = @Translation("Menu"), * controllers = { - * "access" = "Drupal\system\MenuAccessController" + * "access" = "Drupal\system\MenuAccessControlHandler" * }, * admin_permission = "administer menu", * entity_keys = { diff --git a/core/modules/system/src/MenuAccessController.php b/core/modules/system/src/MenuAccessControlHandler.php index fe84368..acee9aa 100644 --- a/core/modules/system/src/MenuAccessController.php +++ b/core/modules/system/src/MenuAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\system\MenuAccessController. + * Contains \Drupal\system\MenuAccessControlHandler. */ namespace Drupal\system; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Session\AccountInterface; /** - * Defines the access controller for the menu entity type. + * Defines the access control handler for the menu entity type. + * + * @see \Drupal\system\Entity\Menu */ -class MenuAccessController extends EntityAccessController { +class MenuAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/system/src/Tests/Entity/EntityAccessTest.php b/core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php index 70f402b..8727cc6 100644 --- a/core/modules/system/src/Tests/Entity/EntityAccessTest.php +++ b/core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php @@ -2,7 +2,7 @@ /** * @file - * Contains Drupal\system\Tests\Entity\EntityAccessTest. + * Contains \Drupal\system\Tests\Entity\EntityAccessHControlandlerTest. */ namespace Drupal\system\Tests\Entity; @@ -10,14 +10,14 @@ namespace Drupal\system\Tests\Entity; use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Access\AccessibleInterface; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; /** - * Tests entity access. + * Tests the entity access control handler. * * @group Entity */ -class EntityAccessTest extends EntityLanguageTestBase { +class EntityAccessControlHandlerTest extends EntityLanguageTestBase { function setUp() { parent::setUp(); @@ -67,16 +67,16 @@ class EntityAccessTest extends EntityLanguageTestBase { } /** - * Ensures that the default controller is used as a fallback. + * Ensures that the default handler is used as a fallback. */ function testEntityAccessDefaultController() { // The implementation requires that the global user id can be loaded. \Drupal::currentUser()->setAccount($this->createUser(array('uid' => 2))); - // Check that the default access controller is used for entities that don't - // have a specific access controller defined. - $controller = $this->container->get('entity.manager')->getAccessController('entity_test_default_access'); - $this->assertTrue($controller instanceof EntityAccessController, 'The default entity controller is used for the entity_test_default_access entity type.'); + // Check that the default access control handler is used for entities that don't + // have a specific access control handler defined. + $handler = $this->container->get('entity.manager')->getAccessControlHandler('entity_test_default_access'); + $this->assertTrue($handler instanceof EntityAccessControlHandler, 'The default entity handler is used for the entity_test_default_access entity type.'); $entity = entity_create('entity_test_default_access'); $this->assertEntityAccess(array( diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php index 7b7efaf..4e94184 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php @@ -23,7 +23,7 @@ use Drupal\user\UserInterface; * controllers = { * "list_builder" = "Drupal\entity_test\EntityTestListBuilder", * "view_builder" = "Drupal\entity_test\EntityTestViewBuilder", - * "access" = "Drupal\entity_test\EntityTestAccessController", + * "access" = "Drupal\entity_test\EntityTestAccessControlHandler", * "form" = { * "default" = "Drupal\entity_test\EntityTestForm", * "delete" = "Drupal\entity_test\EntityTestDeleteForm" diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php index 0c0c753..e9e7123 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php @@ -17,7 +17,7 @@ use Drupal\Core\Field\FieldDefinition; * id = "entity_test_base_field_display", * label = @Translation("Test entity - base field display"), * controllers = { - * "access" = "Drupal\entity_test\EntityTestAccessController", + * "access" = "Drupal\entity_test\EntityTestAccessControlHandler", * "form" = { * "default" = "Drupal\entity_test\EntityTestForm" * }, diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCache.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCache.php index ab5fdab..a6e02e1 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCache.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestCache.php @@ -14,7 +14,7 @@ namespace Drupal\entity_test\Entity; * id = "entity_test_cache", * label = @Translation("Test entity with field cache"), * controllers = { - * "access" = "Drupal\entity_test\EntityTestAccessController", + * "access" = "Drupal\entity_test\EntityTestAccessControlHandler", * "form" = { * "default" = "Drupal\entity_test\EntityTestForm" * }, diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultAccess.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultAccess.php index 7df4362..239250f 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultAccess.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestDefaultAccess.php @@ -8,7 +8,7 @@ namespace Drupal\entity_test\Entity; /** - * Defines a test entity class with no access controller. + * Defines a test entity class with no access control handler. * * @ContentEntityType( * id = "entity_test_default_access", diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php index a8abda5..c5227e4 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php @@ -19,7 +19,7 @@ use Drupal\entity_test\Entity\EntityTest; * label = @Translation("Test entity - data table"), * controllers = { * "view_builder" = "Drupal\entity_test\EntityTestViewBuilder", - * "access" = "Drupal\entity_test\EntityTestAccessController", + * "access" = "Drupal\entity_test\EntityTestAccessControlHandler", * "form" = { * "default" = "Drupal\entity_test\EntityTestForm", * "delete" = "Drupal\entity_test\EntityTestDeleteForm" diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php index b30cbb1..477b651 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMulRev.php @@ -18,7 +18,7 @@ use Drupal\entity_test\Entity\EntityTestRev; * id = "entity_test_mulrev", * label = @Translation("Test entity - revisions and data table"), * controllers = { - * "access" = "Drupal\entity_test\EntityTestAccessController", + * "access" = "Drupal\entity_test\EntityTestAccessControlHandler", * "form" = { * "default" = "Drupal\entity_test\EntityTestForm", * "delete" = "Drupal\entity_test\EntityTestDeleteForm" diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php index ea99ed0..9424241 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestRev.php @@ -18,7 +18,7 @@ use Drupal\entity_test\Entity\EntityTest; * id = "entity_test_rev", * label = @Translation("Test entity - revisions"), * controllers = { - * "access" = "Drupal\entity_test\EntityTestAccessController", + * "access" = "Drupal\entity_test\EntityTestAccessControlHandler", * "form" = { * "default" = "Drupal\entity_test\EntityTestForm", * "delete" = "Drupal\entity_test\EntityTestDeleteForm" diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php index 627d3a5..dbe4a20 100644 --- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php +++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php @@ -16,7 +16,7 @@ use Drupal\Core\Entity\EntityTypeInterface; * id = "entity_test_string_id", * label = @Translation("Test entity with string_id"), * controllers = { - * "access" = "Drupal\entity_test\EntityTestAccessController", + * "access" = "Drupal\entity_test\EntityTestAccessControlHandler", * "form" = { * "default" = "Drupal\entity_test\EntityTestForm" * }, diff --git a/core/modules/system/tests/modules/entity_test/src/EntityTestAccessController.php b/core/modules/system/tests/modules/entity_test/src/EntityTestAccessControlHandler.php index 9f5fd46..d16f6ab 100644 --- a/core/modules/system/tests/modules/entity_test/src/EntityTestAccessController.php +++ b/core/modules/system/tests/modules/entity_test/src/EntityTestAccessControlHandler.php @@ -2,20 +2,28 @@ /** * @file - * Contains Drupal\entity_test\EntityTestAccessController. + * Contains Drupal\entity_test\EntityTestAccessControlHandler. */ namespace Drupal\entity_test; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines the access controller for the test entity type. + * Defines the access control handler for the test entity type. + * + * @see \Drupal\entity_test\Entity\EntityTest + * @see \Drupal\entity_test\Entity\EntityTestBaseFieldDisplay + * @see \Drupal\entity_test\Entity\EntityTestCache + * @see \Drupal\entity_test\Entity\EntityTestMul + * @see \Drupal\entity_test\Entity\EntityTestMulRev + * @see \Drupal\entity_test\Entity\EntityTestRev + * @see \Drupal\entity_test\Entity\EntityTestStringId */ -class EntityTestAccessController extends EntityAccessController { +class EntityTestAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/taxonomy/src/Entity/Term.php b/core/modules/taxonomy/src/Entity/Term.php index 6557171..d01759f 100644 --- a/core/modules/taxonomy/src/Entity/Term.php +++ b/core/modules/taxonomy/src/Entity/Term.php @@ -23,7 +23,7 @@ use Drupal\taxonomy\TermInterface; * controllers = { * "storage" = "Drupal\taxonomy\TermStorage", * "view_builder" = "Drupal\taxonomy\TermViewBuilder", - * "access" = "Drupal\taxonomy\TermAccessController", + * "access" = "Drupal\taxonomy\TermAccessControlHandler", * "form" = { * "default" = "Drupal\taxonomy\TermForm", * "delete" = "Drupal\taxonomy\Form\TermDeleteForm" diff --git a/core/modules/taxonomy/src/TermAccessController.php b/core/modules/taxonomy/src/TermAccessControlHandler.php index ca98dbb..fe38a4c 100644 --- a/core/modules/taxonomy/src/TermAccessController.php +++ b/core/modules/taxonomy/src/TermAccessControlHandler.php @@ -2,21 +2,21 @@ /** * @file - * Contains \Drupal\taxonomy\TermAccessController. + * Contains \Drupal\taxonomy\TermAccessControlHandler. */ namespace Drupal\taxonomy; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines an access controller for the taxonomy term entity. + * Defines the access control handler for the taxonomy term entity type. * * @see \Drupal\taxonomy\Entity\Term */ -class TermAccessController extends EntityAccessController { +class TermAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/user/src/Entity/Role.php b/core/modules/user/src/Entity/Role.php index 20cb004..e5a6f8b 100644 --- a/core/modules/user/src/Entity/Role.php +++ b/core/modules/user/src/Entity/Role.php @@ -19,7 +19,7 @@ use Drupal\user\RoleInterface; * label = @Translation("Role"), * controllers = { * "storage" = "Drupal\user\RoleStorage", - * "access" = "Drupal\user\RoleAccessController", + * "access" = "Drupal\user\RoleAccessControlHandler", * "list_builder" = "Drupal\user\RoleListBuilder", * "form" = { * "default" = "Drupal\user\RoleForm", diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php index eeb8d55..cd2fb48 100644 --- a/core/modules/user/src/Entity/User.php +++ b/core/modules/user/src/Entity/User.php @@ -25,7 +25,7 @@ use Drupal\user\UserInterface; * label = @Translation("User"), * controllers = { * "storage" = "Drupal\user\UserStorage", - * "access" = "Drupal\user\UserAccessController", + * "access" = "Drupal\user\UserAccessControlHandler", * "list_builder" = "Drupal\user\UserListBuilder", * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", * "form" = { diff --git a/core/modules/user/src/RoleAccessController.php b/core/modules/user/src/RoleAccessControlHandler.php index 0ab9ad8..c53c2a3 100644 --- a/core/modules/user/src/RoleAccessController.php +++ b/core/modules/user/src/RoleAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\user\RoleAccessController. + * Contains \Drupal\user\RoleAccessControlHandler. */ namespace Drupal\user; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines the access controller for the user_role entity type. + * Defines the access control handler for the user role entity type. + * + * @see \Drupal\user\Entity\Role */ -class RoleAccessController extends EntityAccessController { +class RoleAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/modules/user/src/UserAccessController.php b/core/modules/user/src/UserAccessControlHandler.php index 9aed19e..81b072f 100644 --- a/core/modules/user/src/UserAccessController.php +++ b/core/modules/user/src/UserAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\user\UserAccessController. + * Contains \Drupal\user\UserAccessControlHandler. */ namespace Drupal\user; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Session\AccountInterface; /** - * Defines the access controller for the user entity type. + * Defines the access control handler for the user entity type. + * + * @see \Drupal\user\Entity\User */ -class UserAccessController extends EntityAccessController { +class UserAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} @@ -43,7 +45,7 @@ class UserAccessController extends EntityAccessController { /** * Check view access. * - * See EntityAccessControllerInterface::view() for parameters. + * See EntityAccessControlHandlerInterface::view() for parameters. */ protected function viewAccess(EntityInterface $entity, $langcode, AccountInterface $account) { // Never allow access to view the anonymous user account. diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php index 0f783ff..5bb0a94 100644 --- a/core/modules/views/src/Entity/View.php +++ b/core/modules/views/src/Entity/View.php @@ -20,7 +20,7 @@ use Drupal\views\ViewStorageInterface; * id = "view", * label = @Translation("View"), * controllers = { - * "access" = "Drupal\views\ViewAccessController" + * "access" = "Drupal\views\ViewAccessControlHandler" * }, * admin_permission = "administer views", * entity_keys = { diff --git a/core/modules/views/src/ViewAccessController.php b/core/modules/views/src/ViewAccessControlHandler.php index 3b22203..1532301 100644 --- a/core/modules/views/src/ViewAccessController.php +++ b/core/modules/views/src/ViewAccessControlHandler.php @@ -2,19 +2,21 @@ /** * @file - * Contains \Drupal\views\ViewAccessController. + * Contains \Drupal\views\ViewAccessControlHandler. */ namespace Drupal\views; -use Drupal\Core\Entity\EntityAccessController; +use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; /** - * Defines the access controller for the view entity type. + * Defines the access control handler for the view entity type. + * + * @see \Drupal\views\Entity\View */ -class ViewAccessController extends EntityAccessController { +class ViewAccessControlHandler extends EntityAccessControlHandler { /** * {@inheritdoc} diff --git a/core/scripts/switch-psr4.sh b/core/scripts/switch-psr4.sh index eb1a480..d9c4e1c 100644 --- a/core/scripts/switch-psr4.sh +++ b/core/scripts/switch-psr4.sh @@ -8,7 +8,7 @@ namespace Drupal\Core\SwitchPsr4; * Moves module-provided class files to their PSR-4 location. * * E.g.: - * core/modules/action/{lib/Drupal/action → src}/ActionAccessController.php + * core/modules/action/{lib/Drupal/action → src}/ActionAccessControlHandler.php * core/modules/action/{lib/Drupal/action → src}/ActionAddForm.php */ diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php index 742426b..aeee601 100644 --- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php @@ -368,7 +368,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { * @covers ::access */ public function testAccess() { - $access = $this->getMock('\Drupal\Core\Entity\EntityAccessControllerInterface'); + $access = $this->getMock('\Drupal\Core\Entity\EntityAccessControlHandlerInterface'); $operation = $this->randomMachineName(); $access->expects($this->at(0)) ->method('access') @@ -378,7 +378,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase { ->method('createAccess') ->will($this->returnValue(TRUE)); $this->entityManager->expects($this->exactly(2)) - ->method('getAccessController') + ->method('getAccessControlHandler') ->will($this->returnValue($access)); $this->assertTrue($this->entity->access($operation)); $this->assertTrue($this->entity->access('create')); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php index e195e4c..bf2ebf3 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php @@ -15,6 +15,7 @@ use Symfony\Component\HttpFoundation\Request; /** * @coversDefaultClass \Drupal\Core\Entity\EntityCreateAccessCheck + * * @group Entity */ class EntityCreateAccessCheckTest extends UnitTestCase { @@ -48,7 +49,7 @@ class EntityCreateAccessCheckTest extends UnitTestCase { array('test_entity', 'entity_test:{bundle_argument}', FALSE, AccessCheckInterface::DENY), array('', 'entity_test:{bundle_argument}', FALSE, AccessCheckInterface::DENY), // When the bundle is not provided, access should be denied even if the - // access controller would allow access. + // access control handler would allow access. array('', 'entity_test:{bundle_argument}', TRUE, AccessCheckInterface::DENY), ); } @@ -61,18 +62,18 @@ class EntityCreateAccessCheckTest extends UnitTestCase { public function testAccess($entity_bundle, $requirement, $access, $expected) { $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); - // Don't expect a call to the access controller when we have a bundle + // Don't expect a call to the access control handler when we have a bundle // argument requirement but no bundle is provided. if ($entity_bundle || strpos($requirement, '{') === FALSE) { - $access_controller = $this->getMock('Drupal\Core\Entity\EntityAccessControllerInterface'); - $access_controller->expects($this->once()) + $access_control_handler = $this->getMock('Drupal\Core\Entity\EntityAccessControlHandlerInterface'); + $access_control_handler->expects($this->once()) ->method('createAccess') ->with($entity_bundle) ->will($this->returnValue($access)); $entity_manager->expects($this->any()) - ->method('getAccessController') - ->will($this->returnValue($access_controller)); + ->method('getAccessControlHandler') + ->will($this->returnValue($access_control_handler)); } $applies_check = new EntityCreateAccessCheck($entity_manager); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php index ce1b573..c86a293 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php @@ -323,19 +323,19 @@ class EntityManagerTest extends UnitTestCase { } /** - * Tests the getAccessController() method. + * Tests the getAccessControlHandler() method. * - * @covers ::getAccessController() + * @covers ::getAccessControlHandler() */ - public function testGetAccessController() { + public function testGetAccessControlHandler() { $class = $this->getTestControllerClass(); $entity = $this->getMock('Drupal\Core\Entity\EntityTypeInterface'); $entity->expects($this->once()) - ->method('getAccessClass') + ->method('getAccessControlClass') ->will($this->returnValue($class)); $this->setUpEntityManager(array('test_entity_type' => $entity)); - $this->assertInstanceOf($class, $this->entityManager->getAccessController('test_entity_type')); + $this->assertInstanceOf($class, $this->entityManager->getAccessControlHandler('test_entity_type')); } /** diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php index 0709a14..82c9321 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php @@ -131,16 +131,16 @@ class EntityTypeTest extends UnitTestCase { } /** - * Tests the getAccessClass() method. + * Tests the getAccessControlClass() method. */ - public function testGetAccessClass() { + public function testGetAccessControlClass() { $controller = $this->getTestControllerClass(); $entity_type = $this->setUpEntityType(array( 'controllers' => array( 'access' => $controller, ), )); - $this->assertSame($controller, $entity_type->getAccessClass()); + $this->assertSame($controller, $entity_type->getAccessControlClass()); } /** diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php index 0e6a67f..a6626f6 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php @@ -207,7 +207,7 @@ class EntityUnitTest extends UnitTestCase { * @covers ::access */ public function testAccess() { - $access = $this->getMock('\Drupal\Core\Entity\EntityAccessControllerInterface'); + $access = $this->getMock('\Drupal\Core\Entity\EntityAccessControlHandlerInterface'); $operation = $this->randomMachineName(); $access->expects($this->at(0)) ->method('access') @@ -217,7 +217,7 @@ class EntityUnitTest extends UnitTestCase { ->method('createAccess') ->will($this->returnValue(TRUE)); $this->entityManager->expects($this->exactly(2)) - ->method('getAccessController') + ->method('getAccessControlHandler') ->will($this->returnValue($access)); $this->assertTrue($this->entity->access($operation)); $this->assertTrue($this->entity->access('create')); |