public function getDraftParameters(Request $request, PageInterface $page)
{
if ($redirect = $this->getRedirect($request, $page)) {
return $redirect;
}
if ($page->getVisibility() != PageInterface::VISIBILITY_PUBLIC) {
if (false === $this->get('security.authorization_checker')->isGranted('ROLE_USER')) {
throw new AccessDeniedException();
}
}
if ($page->getStatus() != PageInterface::STATUS_PUBLISHED) {
if (!$this->get('security.token_storage')->getToken() || false === $this->get('security.authorization_checker')->isGranted('ROLE_SONATA_ADMIN')) {
$message = 'The requested page has the status "' . $page->getStatus() . '", please login to view page';
throw $this->createNotFoundException($message);
}
}
return array('page' => $page, 'admin_pool' => $this->getAdminPool());
}