From 82b00091d5bdeef8989d0920abc7f7086bb7416a Mon Sep 17 00:00:00 2001 From: Francesco Tassi Date: Tue, 26 Mar 2013 15:40:31 +0100 Subject: [PATCH 1/2] Fix how to safely use is_granted in error pages --- cookbook/controller/error_pages.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/controller/error_pages.rst b/cookbook/controller/error_pages.rst index b289a5f4682..9e333210146 100644 --- a/cookbook/controller/error_pages.rst +++ b/cookbook/controller/error_pages.rst @@ -56,7 +56,7 @@ end-user, create a new template located at by your error pages), because the router runs before the firewall. If the router throws an exception (for instance, when the route does not match), then using ``is_granted`` will throw a further exception. You - can use ``is_granted`` safely by saying ``{% if app.security and is_granted('...') %}``. + can use ``is_granted`` safely by saying ``{% if app.user and is_granted('...') %}``. .. tip:: From b2cd3457acf1b39dbd28090fae997681c6eedd34 Mon Sep 17 00:00:00 2001 From: Francesco Tassi Date: Tue, 26 Mar 2013 16:13:06 +0100 Subject: [PATCH 2/2] Fix app.user check --- cookbook/controller/error_pages.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/controller/error_pages.rst b/cookbook/controller/error_pages.rst index 9e333210146..f794924a74a 100644 --- a/cookbook/controller/error_pages.rst +++ b/cookbook/controller/error_pages.rst @@ -56,7 +56,7 @@ end-user, create a new template located at by your error pages), because the router runs before the firewall. If the router throws an exception (for instance, when the route does not match), then using ``is_granted`` will throw a further exception. You - can use ``is_granted`` safely by saying ``{% if app.user and is_granted('...') %}``. + can use ``is_granted`` safely by saying ``{% if app.user is not null and is_granted('...') %}``. .. tip::