public static function TemporaryQueryGuard::applyAccessControls in JSON:API 8
Same name and namespace in other branches
- 8.2 src/Access/TemporaryQueryGuard.php \Drupal\jsonapi\Access\TemporaryQueryGuard::applyAccessControls()
Applies access controls to an entity query.
Parameters
\Drupal\jsonapi\Query\Filter $filter: The filters applicable to the query.
\Drupal\Core\Entity\Query\QueryInterface $query: The query to which access controls should be applied.
\Drupal\Core\Cache\CacheableMetadata $cacheability: Collects cacheability for the query.
1 call to TemporaryQueryGuard::applyAccessControls()
- EntityResource::getCollectionQuery in src/
Controller/ EntityResource.php - Gets a basic query for a collection.
File
- src/
Access/ TemporaryQueryGuard.php, line 79
Class
- TemporaryQueryGuard
- Adds sufficient access control to collection queries.
Namespace
Drupal\jsonapi\AccessCode
public static function applyAccessControls(Filter $filter, QueryInterface $query, CacheableMetadata $cacheability) {
assert(static::$fieldManager !== NULL);
assert(static::$moduleHandler !== NULL);
$filtered_fields = static::collectFilteredFields($filter
->root());
$field_specifiers = array_map(function ($field) {
return explode('.', $field);
}, $filtered_fields);
static::secureQuery($query, $query
->getEntityTypeId(), static::buildTree($field_specifiers), $cacheability);
}