Problem/Motivation
This module does not currently add accessCheck() to the log query it uses in AssetTerminationItemList.php.
In farmOS v3 (Drupal 10) this causes an error:
Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck().
Related change record: https://www.drupal.org/node/3201242
Steps to reproduce
- Install in farmOS v3 instance.
- Go to an API asset endpoint (eg:
/api/asset/plant). - Observe the error.
Proposed resolution
Add $query->accessCheck(TRUE); between lines 31 and 32 here:
https://git.drupalcode.org/project/farm_asset_termination/-/blob/af9f6ea...
We may also want to consider setting this by default in farmOS core's LogQueryFactory::getQuery() method (with a default of accessCheck(TRUE), but an option to override). But that would be a feature request for farmOS core, whereas this is a bug report currently in farm_asset_termination, so I think we should fix here and then follow up in core if that makes sense.
Remaining tasks
Create a MR for review.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork farm_asset_termination-3422030
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
m.stentaComment #4
wotnakComment #6
wotnakMerged and released in v1.2.2.
Comment #7
m.stentaThanks @wotnak!