Problem/Motivation

When using the autocomplete field on a D10 site, when the entity form is submitted the following error is reported:

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: 145)
Drupal\synonyms\Plugin\Synonyms\Provider\Field->synonymsFind(Object) (Line: 163)
Drupal\synonyms_autocomplete\SynonymsService\Behavior\AutocompleteService->autocompleteLookup('Something', 'TN7nv2ukYglHIiBGtNQZM1GYCGtqGVXJ2YIWbXx85zk') (Line: 118)
Drupal\synonyms_autocomplete\Element\SynonymsEntityAutocomplete::validateEntityAutocomplete(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 282)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Issue summary: View changes
damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new2.07 KB

This seems to work for me locally, while working on other issues.

devad’s picture

StatusFileSize
new5.1 KB

I have found a few more places where queries were submitted without accessCheck() specified.

I have added the $query->accessCheck(TRUE); line to all these queries. I guess there is no harm in doing that since accessCheck(TRUE) was the default behavior prior to D10.

damienmckenna’s picture

Agreed, from what I can see there aren't any scenarios in the Synonyms module where it should not adhere to access restrictions.

  • devad committed 523f56a2 on 2.1.x
    Issue #3377858 by DamienMcKenna, devad: Query accessCheck() error when...
devad’s picture

Status: Needs review » Fixed

Thanks for review. Committed to dev.

Status: Fixed » Closed (fixed)

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