Access checking must be explicitly specified on content entity queries

Created on 21 November 2023, about 1 year ago
Updated 7 December 2023, about 1 year ago

Problem/Motivation

Executing an entity query without an access check specified is removed in D10.

Steps to reproduce

Attempt to create a reader_chapter node, results in error:

POST request to: http://web/node/add/reader_chapter?reader_publication_id=212The website encountered an unexpected error. Please try again later.

Drupal\Core\Entity\EntityStorageException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php). 

Proposed resolution

Add a call to ->accessCheck() on entity queries.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024