tft_file_access missing accessCheck

Created on 28 August 2023, about 1 year ago
Updated 4 April 2024, 8 months ago

[Error] [php] 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 162 of /htdocs/core/lib/Drupal/Core/Entity/Query/Sql/Query.php).

if we use https://github.com/podarok/drupal/commit/5656ba39204d105ca7c26535ed963d0...
+ debug_print_backtrace();

we can see more detail in the error:

modules/contrib/tft/tft.module

/**
 * Implements hook_ENTITY_TYPE_access().
 */
function tft_file_access(EntityInterface $entity, $operation, AccountInterface $account) {
  // Check that user has an access to the group.
  $fid = $entity->get('fid')->getValue();
  $query = \Drupal::entityQuery('media')
    ->condition('tft_file', $fid[0]['value']);
  $entity_id = array_values($query->execute());
  if (isset($entity_id[0])) {
    $media = Media::load($entity_id[0]);
  }

missing accessCheck(FALSE) or TRUE

🐛 Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

🇺🇸United States jakegibs617

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024