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

  1. Install in farmOS v3 instance.
  2. Go to an API asset endpoint (eg: /api/asset/plant).
  3. 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.

Command icon 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

m.stenta created an issue. See original summary.

m.stenta’s picture

Status: Active » Needs review
wotnak’s picture

Status: Needs review » Reviewed & tested by the community

  • wotnak committed b83e5de2 on 1.x authored by m.stenta
    Issue #3422030 by m.stenta: Fix error: Entity queries must explicitly...
wotnak’s picture

Status: Reviewed & tested by the community » Fixed

Merged and released in v1.2.2.

m.stenta’s picture

Thanks @wotnak!

Status: Fixed » Closed (fixed)

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