diff --git a/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php b/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php index f6bf463b16..81d94b5c40 100644 --- a/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php +++ b/core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php @@ -2,6 +2,7 @@ namespace Drupal\Core\Config\Entity; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -47,10 +48,17 @@ protected $formBuilder; /** - * {@inheritdoc} + * Constructs a new DraggableListBuilder object. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. + * @param \Drupal\Core\Entity\EntityStorageInterface $storage + * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler) { + parent::__construct($entity_type, $storage, $access_control_handler); // Check if the entity type supports weighting. if ($this->entityType->hasKey('weight')) { diff --git a/core/modules/action/src/ActionListBuilder.php b/core/modules/action/src/ActionListBuilder.php index 2167d8e094..0453b0d6e3 100644 --- a/core/modules/action/src/ActionListBuilder.php +++ b/core/modules/action/src/ActionListBuilder.php @@ -3,6 +3,7 @@ namespace Drupal\action; use Drupal\Core\Action\ActionManager; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Entity\EntityStorageInterface; @@ -36,11 +37,13 @@ class ActionListBuilder extends ConfigEntityListBuilder { * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The action storage. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Action\ActionManager $action_manager * The action plugin manager. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ActionManager $action_manager) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, ActionManager $action_manager) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->actionManager = $action_manager; } @@ -52,6 +55,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('plugin.manager.action') ); } diff --git a/core/modules/block/src/BlockListBuilder.php b/core/modules/block/src/BlockListBuilder.php index 37b2e8bfc3..8dc47b23e6 100644 --- a/core/modules/block/src/BlockListBuilder.php +++ b/core/modules/block/src/BlockListBuilder.php @@ -5,6 +5,7 @@ use Drupal\Component\Utility\Html; use Drupal\Component\Serialization\Json; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -63,13 +64,15 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Theme\ThemeManagerInterface $theme_manager * The theme manager. * @param \Drupal\Core\Form\FormBuilderInterface $form_builder * The form builder. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ThemeManagerInterface $theme_manager, FormBuilderInterface $form_builder) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, ThemeManagerInterface $theme_manager, FormBuilderInterface $form_builder) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->themeManager = $theme_manager; $this->formBuilder = $form_builder; @@ -82,6 +85,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('theme.manager'), $container->get('form_builder') ); diff --git a/core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php b/core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php index c226dfbd60..06624688f1 100644 --- a/core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php +++ b/core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php @@ -2,6 +2,7 @@ namespace Drupal\config_translation\Controller; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -21,10 +22,19 @@ class ConfigTranslationBlockListBuilder extends ConfigTranslationEntityListBuild protected $themes = []; /** - * {@inheritdoc} + * Constructs a ConfigTranslationBlockListBuilder object. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. + * @param \Drupal\Core\Entity\EntityStorageInterface $storage + * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. + * @param ThemeHandlerInterface $theme_handler + * The theme handler. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ThemeHandlerInterface $theme_handler) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, ThemeHandlerInterface $theme_handler) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->themes = $theme_handler->listInfo(); } @@ -35,6 +45,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('theme_handler') ); } diff --git a/core/modules/config_translation/src/Controller/ConfigTranslationFieldListBuilder.php b/core/modules/config_translation/src/Controller/ConfigTranslationFieldListBuilder.php index 566afdbb23..4e3c4a5de2 100644 --- a/core/modules/config_translation/src/Controller/ConfigTranslationFieldListBuilder.php +++ b/core/modules/config_translation/src/Controller/ConfigTranslationFieldListBuilder.php @@ -3,6 +3,7 @@ namespace Drupal\config_translation\Controller; use Drupal\Component\Utility\Unicode; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityStorageInterface; @@ -50,6 +51,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $entity_manager->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $entity_manager ); } @@ -61,11 +63,13 @@ public static function createInstance(ContainerInterface $container, EntityTypeI * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityManagerInterface $entity_manager) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, EntityManagerInterface $entity_manager) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->entityManager = $entity_manager; } diff --git a/core/modules/field_ui/src/EntityDisplayModeListBuilder.php b/core/modules/field_ui/src/EntityDisplayModeListBuilder.php index c9d8966278..6475f83c42 100644 --- a/core/modules/field_ui/src/EntityDisplayModeListBuilder.php +++ b/core/modules/field_ui/src/EntityDisplayModeListBuilder.php @@ -3,6 +3,7 @@ namespace Drupal\field_ui; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -30,11 +31,13 @@ class EntityDisplayModeListBuilder extends ConfigEntityListBuilder { * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Entity\EntityTypeInterface[] $entity_types * List of all entity types. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, array $entity_types) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, array $entity_types) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->entityTypes = $entity_types; } @@ -47,6 +50,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $entity_manager->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $entity_manager->getDefinitions() ); } diff --git a/core/modules/field_ui/src/FieldConfigListBuilder.php b/core/modules/field_ui/src/FieldConfigListBuilder.php index cb720c32a9..5988f5424e 100644 --- a/core/modules/field_ui/src/FieldConfigListBuilder.php +++ b/core/modules/field_ui/src/FieldConfigListBuilder.php @@ -4,6 +4,7 @@ use Drupal\Component\Utility\Html; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -52,11 +53,13 @@ class FieldConfigListBuilder extends ConfigEntityListBuilder { * The entity type definition. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager * The field type manager */ - public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager) { - parent::__construct($entity_type, $entity_manager->getStorage($entity_type->id())); + public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, EntityAccessControlHandlerInterface $access_control_handler, FieldTypePluginManagerInterface $field_type_manager) { + parent::__construct($entity_type, $entity_manager->getStorage($entity_type->id()), $access_control_handler); $this->entityManager = $entity_manager; $this->fieldTypeManager = $field_type_manager; @@ -66,7 +69,12 @@ public function __construct(EntityTypeInterface $entity_type, EntityManagerInter * {@inheritdoc} */ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { - return new static($entity_type, $container->get('entity.manager'), $container->get('plugin.manager.field.field_type')); + return new static( + $entity_type, + $container->get('entity.manager'), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), + $container->get('plugin.manager.field.field_type') + ); } /** diff --git a/core/modules/field_ui/src/FieldStorageConfigListBuilder.php b/core/modules/field_ui/src/FieldStorageConfigListBuilder.php index f82bd9df1d..74db6d67b5 100644 --- a/core/modules/field_ui/src/FieldStorageConfigListBuilder.php +++ b/core/modules/field_ui/src/FieldStorageConfigListBuilder.php @@ -3,6 +3,7 @@ namespace Drupal\field_ui; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -53,11 +54,13 @@ class FieldStorageConfigListBuilder extends ConfigEntityListBuilder { * The entity type definition. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager * The 'field type' plugin manager. */ - public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, EntityTypeBundleInfoInterface $bundle_info_service) { - parent::__construct($entity_type, $entity_manager->getStorage($entity_type->id())); + public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, EntityAccessControlHandlerInterface $access_control_handler, FieldTypePluginManagerInterface $field_type_manager, EntityTypeBundleInfoInterface $bundle_info_service) { + parent::__construct($entity_type, $entity_manager->getStorage($entity_type->id()), $access_control_handler); $this->entityManager = $entity_manager; $this->bundles = $bundle_info_service->getAllBundleInfo(); @@ -72,6 +75,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager'), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('plugin.manager.field.field_type'), $container->get('entity_type.bundle.info') ); diff --git a/core/modules/filter/src/FilterFormatListBuilder.php b/core/modules/filter/src/FilterFormatListBuilder.php index cf084564c0..8343095ad2 100644 --- a/core/modules/filter/src/FilterFormatListBuilder.php +++ b/core/modules/filter/src/FilterFormatListBuilder.php @@ -4,6 +4,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\Entity\DraggableListBuilder; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -36,11 +37,13 @@ class FilterFormatListBuilder extends DraggableListBuilder { * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ConfigFactoryInterface $config_factory) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, ConfigFactoryInterface $config_factory) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->configFactory = $config_factory; } @@ -52,6 +55,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('config.factory') ); } diff --git a/core/modules/language/src/LanguageListBuilder.php b/core/modules/language/src/LanguageListBuilder.php index 8d15152204..168e4e88db 100644 --- a/core/modules/language/src/LanguageListBuilder.php +++ b/core/modules/language/src/LanguageListBuilder.php @@ -4,6 +4,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\Entity\DraggableListBuilder; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -44,6 +45,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('language_manager'), $container->get('config.factory') ); @@ -56,13 +58,15 @@ public static function createInstance(ContainerInterface $container, EntityTypeI * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage handler class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The factory for configuration objects. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->languageManager = $language_manager; $this->configFactory = $config_factory; } diff --git a/core/modules/node/src/NodeListBuilder.php b/core/modules/node/src/NodeListBuilder.php index eac48fda31..174281a20e 100644 --- a/core/modules/node/src/NodeListBuilder.php +++ b/core/modules/node/src/NodeListBuilder.php @@ -3,6 +3,7 @@ namespace Drupal\node; use Drupal\Core\Datetime\DateFormatterInterface; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityListBuilder; use Drupal\Core\Entity\EntityStorageInterface; @@ -32,13 +33,15 @@ class NodeListBuilder extends EntityListBuilder { * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter * The date formatter service. * @param \Drupal\Core\Routing\RedirectDestinationInterface $redirect_destination * The redirect destination service. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, DateFormatterInterface $date_formatter, RedirectDestinationInterface $redirect_destination) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, DateFormatterInterface $date_formatter, RedirectDestinationInterface $redirect_destination) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->dateFormatter = $date_formatter; $this->redirectDestination = $redirect_destination; @@ -51,6 +54,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('date.formatter'), $container->get('redirect.destination') ); diff --git a/core/modules/search/src/SearchPageListBuilder.php b/core/modules/search/src/SearchPageListBuilder.php index 9a8f6deb30..96389659fd 100644 --- a/core/modules/search/src/SearchPageListBuilder.php +++ b/core/modules/search/src/SearchPageListBuilder.php @@ -4,6 +4,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\Entity\DraggableListBuilder; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -49,13 +50,15 @@ class SearchPageListBuilder extends DraggableListBuilder implements FormInterfac * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\search\SearchPluginManager $search_manager * The search plugin manager. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The factory for configuration objects. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, SearchPluginManager $search_manager, ConfigFactoryInterface $config_factory) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, SearchPluginManager $search_manager, ConfigFactoryInterface $config_factory) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->configFactory = $config_factory; $this->searchManager = $search_manager; } @@ -67,6 +70,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('plugin.manager.search'), $container->get('config.factory') ); diff --git a/core/modules/system/src/DateFormatListBuilder.php b/core/modules/system/src/DateFormatListBuilder.php index c0e2c366f0..df9e23a662 100644 --- a/core/modules/system/src/DateFormatListBuilder.php +++ b/core/modules/system/src/DateFormatListBuilder.php @@ -4,6 +4,7 @@ use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Datetime\DateFormatterInterface; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -30,11 +31,13 @@ class DateFormatListBuilder extends ConfigEntityListBuilder { * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter * The date formatter service. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, DateFormatterInterface $date_formatter) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, DateFormatterInterface $date_formatter) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->dateFormatter = $date_formatter; } @@ -46,6 +49,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('date.formatter') ); } diff --git a/core/modules/taxonomy/src/VocabularyListBuilder.php b/core/modules/taxonomy/src/VocabularyListBuilder.php index e7c021b4d7..0b5055455d 100644 --- a/core/modules/taxonomy/src/VocabularyListBuilder.php +++ b/core/modules/taxonomy/src/VocabularyListBuilder.php @@ -3,6 +3,7 @@ namespace Drupal\taxonomy; use Drupal\Core\Config\Entity\DraggableListBuilder; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; @@ -52,13 +53,15 @@ class VocabularyListBuilder extends DraggableListBuilder { * The entity type definition. * @param \Drupal\Core\Session\AccountInterface $current_user * The current user. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The entity manager service. * @param \Drupal\Core\Render\RendererInterface $renderer * The renderer service. */ - public function __construct(EntityTypeInterface $entity_type, AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer = NULL) { - parent::__construct($entity_type, $entity_type_manager->getStorage($entity_type->id())); + public function __construct(EntityTypeInterface $entity_type, AccountInterface $current_user, EntityAccessControlHandlerInterface $access_control_handler, EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer = NULL) { + parent::__construct($entity_type, $entity_type_manager->getStorage($entity_type->id()), $access_control_handler); $this->currentUser = $current_user; $this->entityTypeManager = $entity_type_manager; @@ -69,10 +72,12 @@ public function __construct(EntityTypeInterface $entity_type, AccountInterface $ * {@inheritdoc} */ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { + $entity_type_manager = $container->get('entity_type.manager'); return new static( $entity_type, $container->get('current_user'), - $container->get('entity_type.manager'), + $entity_type_manager->getAccessControlHandler($entity_type->id()), + $entity_type_manager, $container->get('renderer') ); } diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php index f254ccff93..0b62ee7201 100644 --- a/core/modules/user/src/Entity/User.php +++ b/core/modules/user/src/Entity/User.php @@ -49,6 +49,7 @@ * }, * links = { * "canonical" = "/user/{user}", + * "add-form" = "/admin/people/create", * "edit-form" = "/user/{user}/edit", * "cancel-form" = "/user/{user}/cancel", * "collection" = "/admin/people", diff --git a/core/modules/user/src/UserListBuilder.php b/core/modules/user/src/UserListBuilder.php index 306d04609e..06a513e062 100644 --- a/core/modules/user/src/UserListBuilder.php +++ b/core/modules/user/src/UserListBuilder.php @@ -4,6 +4,7 @@ use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Datetime\DateFormatterInterface; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityListBuilder; use Drupal\Core\Entity\EntityStorageInterface; @@ -39,13 +40,15 @@ class UserListBuilder extends EntityListBuilder { * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter * The date formatter service. * @param \Drupal\Core\Routing\RedirectDestinationInterface $redirect_destination * The redirect destination service. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, DateFormatterInterface $date_formatter, RedirectDestinationInterface $redirect_destination) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, DateFormatterInterface $date_formatter, RedirectDestinationInterface $redirect_destination) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->dateFormatter = $date_formatter; $this->redirectDestination = $redirect_destination; } @@ -57,6 +60,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('date.formatter'), $container->get('redirect.destination') ); diff --git a/core/modules/views_ui/src/ViewListBuilder.php b/core/modules/views_ui/src/ViewListBuilder.php index 42166be1a5..84958d8aef 100644 --- a/core/modules/views_ui/src/ViewListBuilder.php +++ b/core/modules/views_ui/src/ViewListBuilder.php @@ -3,6 +3,7 @@ namespace Drupal\views_ui; use Drupal\Component\Plugin\PluginManagerInterface; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Entity\EntityStorageInterface; @@ -36,6 +37,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('plugin.manager.views.display') ); } @@ -47,11 +49,13 @@ public static function createInstance(ContainerInterface $container, EntityTypeI * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Component\Plugin\PluginManagerInterface $display_manager * The views display plugin manager to use. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, PluginManagerInterface $display_manager) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, PluginManagerInterface $display_manager) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->displayManager = $display_manager; // This list builder uses client-side filters which requires all entities to diff --git a/core/modules/workflows/src/WorkflowListBuilder.php b/core/modules/workflows/src/WorkflowListBuilder.php index c36171aa6e..2dc15dd4ed 100644 --- a/core/modules/workflows/src/WorkflowListBuilder.php +++ b/core/modules/workflows/src/WorkflowListBuilder.php @@ -4,6 +4,7 @@ use Drupal\Component\Plugin\PluginManagerInterface; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; +use Drupal\Core\Entity\EntityAccessControlHandlerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -28,6 +29,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI return new static( $entity_type, $container->get('entity_type.manager')->getStorage($entity_type->id()), + $container->get('entity_type.manager')->getAccessControlHandler($entity_type->id()), $container->get('plugin.manager.workflows.type') ); } @@ -39,11 +41,13 @@ public static function createInstance(ContainerInterface $container, EntityTypeI * The entity type definition. * @param \Drupal\Core\Entity\EntityStorageInterface $storage * The entity storage class. + * @param \Drupal\Core\Entity\EntityAccessControlHandlerInterface $access_control_handler + * The access control handler. * @param \Drupal\Component\Plugin\PluginManagerInterface $workflow_type_manager * The workflow type plugin manager. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, PluginManagerInterface $workflow_type_manager) { - parent::__construct($entity_type, $storage); + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityAccessControlHandlerInterface $access_control_handler, PluginManagerInterface $workflow_type_manager) { + parent::__construct($entity_type, $storage, $access_control_handler); $this->workflowTypeManager = $workflow_type_manager; }