Commit eebd0637 authored by webchick's avatar webchick

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

parent 7e465a9b
......@@ -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;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment