diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php index f8d4cae..984c094 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php @@ -297,7 +297,7 @@ protected function getDefinitionFromEntity($key) { */ public function getHighestId() { $values = $this->storage->getQuery() - ->accessCheck(FALSE) + //->accessCheck(FALSE) ->sort($this->getKey('id'), 'DESC') ->range(0, 1) ->execute(); diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php index 06c158a..60293d4 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php @@ -98,7 +98,7 @@ public function getIds() { */ public function getHighestId() { $values = $this->storage->getQuery() - ->accessCheck(FALSE) + //->accessCheck(FALSE) ->allRevisions() ->sort($this->getKey('revision'), 'DESC') ->range(0, 1) diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php index 256e469..a0bb591 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php @@ -173,4 +173,24 @@ public function testDraftRevisionIdConflicts() { $this->assertFalse($result->passed()); } + /** + * Tests ID conflicts for inaccessible nodes. + */ + public function testNodeGrantsIdConflicts() { + // Enable the node_test module to restrict access to page nodes. + $this->enableModules(['node_test']); + + // Create a published node of type page. + $node = Node::create(['type' => 'page', 'title' => 'foo']); + $node->moderation_state->value = 'published'; + $node->save(); + + // Audit the IDs of the d6_node migration. There should be conflicts + // even though the new node is not accessible. + /** @var \Drupal\migrate\Audit\AuditResult $result */ + $result = (new IdAuditor())->audit($this->getMigration('d6_node:page')); + $this->assertInstanceOf(AuditResult::class, $result); + $this->assertFalse($result->passed()); + } + } diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7AuditIdsTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7AuditIdsTest.php index 377985a..1d74423 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7AuditIdsTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7AuditIdsTest.php @@ -172,4 +172,24 @@ public function testDraftRevisionIdConflicts() { $this->assertFalse($result->passed()); } + /** + * Tests ID conflicts for inaccessible nodes. + */ + public function testNodeGrantsIdConflicts() { + // Enable the node_test module to restrict access to page nodes. + $this->enableModules(['node_test']); + + // Create a published node of type page. + $node = Node::create(['type' => 'page', 'title' => 'foo']); + $node->moderation_state->value = 'published'; + $node->save(); + + // Audit the IDs of the d7_node migration. There should be conflicts + // even though the new node is not accessible. + /** @var \Drupal\migrate\Audit\AuditResult $result */ + $result = (new IdAuditor())->audit($this->getMigration('d7_node:page')); + $this->assertInstanceOf(AuditResult::class, $result); + $this->assertFalse($result->passed()); + } + }