Problem/Motivation

accessCheck() issue on the block plugin.

The website encountered an unexpected error. Please try again later.

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).
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 84)
Drupal\questions_answers\Plugin\Block\ModerationAlerts->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func_array(Array, Array) (Line: 111)

Steps to reproduce

  • Enable module
  • Set permissions
  • Render block on the page using block layout.

Proposed resolution

Add accessCheck() in all entity queries.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#5 3379856-5.patch4.02 KBkeshavv
#3 3379856-3.patch1.19 KBkeshavv

Comments

keshavv created an issue. See original summary.

keshavv’s picture

Issue summary: View changes
keshavv’s picture

Status: Active » Needs review
StatusFileSize
new1.19 KB
keshavv’s picture

Title: Encountered an unexpected error while placing block. » Encountered an unexpected error while placing block, Missing accessCheck()
Issue summary: View changes
keshavv’s picture

StatusFileSize
new4.02 KB

I have found the issue in many other places as well.
Updating patch to cover all.

daniel.moberly’s picture

Committed

daniel.moberly’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.