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
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3377858-04.patch | 5.1 KB | devad |
Comments
Comment #2
damienmckennaComment #3
damienmckennaThis seems to work for me locally, while working on other issues.
Comment #4
devad commentedI 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.Comment #5
damienmckennaAgreed, from what I can see there aren't any scenarios in the Synonyms module where it should not adhere to access restrictions.
Comment #7
devad commentedThanks for review. Committed to dev.