protected function checkLocation($id)
{
/** @var \eZ\Publish\API\Repository\Values\Content\Location $location */
$location = $this->repository->sudo(function (Repository $repository) use($id) {
return $repository->getLocationService()->loadLocation($id);
});
// Check both 'content/read' and 'content/view_embed'.
if (!$this->authorizationChecker->isGranted(new AuthorizationAttribute('content', 'read', array('valueObject' => $location->contentInfo, 'targets' => $location))) && !$this->authorizationChecker->isGranted(new AuthorizationAttribute('content', 'view_embed', array('valueObject' => $location->contentInfo, 'targets' => $location)))) {
throw new AccessDeniedException();
}
return $location;
}