eZ\Publish\Core\MVC\Symfony\FieldType\RichText\Renderer::checkContent PHP Method

checkContent() protected method

Check embed permissions for the given Content $id.
protected checkContent ( integer | string $id )
$id integer | string
    protected function checkContent($id)
    {
        /** @var \eZ\Publish\API\Repository\Values\Content\Content $content */
        $content = $this->repository->sudo(function (Repository $repository) use($id) {
            return $repository->getContentService()->loadContent($id);
        });
        // Check both 'content/read' and 'content/view_embed'.
        if (!$this->authorizationChecker->isGranted(new AuthorizationAttribute('content', 'read', array('valueObject' => $content))) && !$this->authorizationChecker->isGranted(new AuthorizationAttribute('content', 'view_embed', array('valueObject' => $content)))) {
            throw new AccessDeniedException();
        }
        // Check that Content is published, since sudo allows loading unpublished content.
        if ($content->getVersionInfo()->status !== VersionInfo::STATUS_PUBLISHED && !$this->authorizationChecker->isGranted(new AuthorizationAttribute('content', 'versionread', array('valueObject' => $content)))) {
            throw new AccessDeniedException();
        }
    }