From 121f6a110cfab10968f07803a2dbb1f7dfd7e8d8 Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Thu, 9 Aug 2012 09:31:44 +0200 Subject: [PATCH] Article view is now security aware ArticleController::viewAction is now aware of Article::public Signed-off-by: Gergely Polonkai --- src/KekRozsak/FrontBundle/Controller/ArticleController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/KekRozsak/FrontBundle/Controller/ArticleController.php b/src/KekRozsak/FrontBundle/Controller/ArticleController.php index 078e9c0..03792d0 100644 --- a/src/KekRozsak/FrontBundle/Controller/ArticleController.php +++ b/src/KekRozsak/FrontBundle/Controller/ArticleController.php @@ -20,6 +20,9 @@ class ArticleController extends Controller */ public function viewAction(Article $article) { + if ((!is_object($this->_securityContext->getToken()) || !is_object($this->_securityContext->getToken()->getUser())) && !$article->isPublic()) + throw new AccessDeniedException('A cikk megtekintéséhez be kell jelentkezned!'); + return array( 'article' => $article, );