Skip to content
Snippets Groups Projects
Commit eebd0637 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #1847600 by amateescu: Fixed Use proper entity 'view' access checks in entity reference.

parent 7e465a9b
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -67,9 +67,7 @@ public function getMatches($field, $instance, $entity_type, $entity_id = '', $pr
if ($entity_id !== 'NULL') {
$entities = $this->entityManager->getStorageController($entity_type)->load(array($entity_id));
$entity = reset($entities);
// @todo: Improve when we have entity_access().
$entity_access = $target_type == 'node' ? node_access('view', $entity) : TRUE;
if (!$entity || !$entity_access) {
if (!$entity || !$entity->access('view')) {
throw new AccessDeniedHttpException();
}
}
......
......@@ -75,9 +75,7 @@ public function prepareView(array $entities, $langcode, array &$items) {
$entity = $target_entities[$identifier];
$items[$id][$delta]['entity'] = $entity;
// @todo: Improve when we have entity_access().
$entity_access = $target_type == 'node' ? node_access('view', $entity) : TRUE;
if (!$entity_access) {
if (!$entity->access('view')) {
continue;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment