Entity queries to check access

Created on 29 November 2023, 12 months ago

Problem/Motivation

WSOD error visiting site audit reports (/admin/reports/site-audit/reports):

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 core/lib/Drupal/Core/Entity/Query/Sql/Query.php).

Proposed resolution

Requires access check in site_audit/site_audit_report_entity/src/SiteAuditReportListBuilder.php load():

public function load() {
    // Sorting my entities.
    $entity_query = \Drupal::entityQuery('site_audit_report')
      ->sort('created' , 'DESC')
      ->accessCheck(FALSE);
...
🐛 Bug report
Status

Needs review

Version

4.0

Component

Code

Created by

🇬🇧United Kingdom robcarr Perthshire, Scotland

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