From 7de47b04ecf189c3cc66711e78d27da3640d36c3 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Mon, 20 Feb 2023 11:23:47 +0000 Subject: [PATCH] Issue #3179850 by claudiu.cristea: EntityTestAccessControlHandler allows viewing an unpublished entity --- .../modules/entity_test/src/EntityTestAccessControlHandler.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/modules/system/tests/modules/entity_test/src/EntityTestAccessControlHandler.php b/core/modules/system/tests/modules/entity_test/src/EntityTestAccessControlHandler.php index 287be829cada..ab4b7caa0fa8 100644 --- a/core/modules/system/tests/modules/entity_test/src/EntityTestAccessControlHandler.php +++ b/core/modules/system/tests/modules/entity_test/src/EntityTestAccessControlHandler.php @@ -55,6 +55,9 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter return AccessResult::allowedIfHasPermission($account, 'view test entity translations'); } } + if ($entity instanceof EntityPublishedInterface && !$entity->isPublished()) { + return AccessResult::neutral('Unpublished entity'); + } return AccessResult::allowedIfHasPermission($account, 'view test entity'); } elseif (in_array($operation, ['update', 'delete'])) { -- GitLab