Drupal\Core\Entity\Query\QueryException: 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\Query\Sql\Query->prepare() (line 141 of /home/

Created on 12 December 2023, 12 months ago
Updated 13 December 2023, 12 months ago

Problem/Motivation

After install site's returning the following error when attempting to access /user in Drupal 10.1.7:

Drupal\Core\Entity\Query\QueryException: 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\Query\Sql\Query->prepare() (line 141 of /home/public_html/****/core/lib/Drupal/Core/Entity/Query/Sql/Query.php).

Proposed resolution

Have queries over entities changed in the User Disk Quota module
With basic accessCheck(FALSE) or pass the needed access check for admins or selected user roles and permissions.

(Quick fix) in user_disk_quota.module Change line 378 from:

$query = \Drupal::entityQueryAggregate('file');

to

$query = \Drupal::entityQueryAggregate('file')->accessCheck(TRUE);

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom siriussolutions

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

Comments & Activities

Production build 0.71.5 2024