src/Controller/EntityResource.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Controller/EntityResource.php b/src/Controller/EntityResource.php index 4463685..c869042 100644 --- a/src/Controller/EntityResource.php +++ b/src/Controller/EntityResource.php @@ -980,12 +980,12 @@ class EntityResource { 'entity' => $entity, ]; if (!$access->isAllowed()) { + // Pass an exception to the list of things to normalize. + $output['entity'] = new EntityAccessDeniedHttpException($entity, $access, '/data', 'The current user is not allowed to GET the selected resource.'); $label_access = $entity->access('view label', NULL, TRUE); - if (!$label_access->isAllowed()) { - // Pass an exception to the list of things to normalize. - $output['entity'] = new EntityAccessDeniedHttpException($entity, $access, '/data', 'The current user is not allowed to GET the selected resource.'); + if ($label_access->isAllowed()) { + $output['entity'] = new LabelOnlyEntity($entity); } - $output['entity'] = new LabelOnlyEntity($entity); } return $output;