Skip to content

Commit f46a61c

Browse files
webdevsHubweaverryan
authored andcommitted
access to user object in twig with global variables
1 parent 115ff31 commit f46a61c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

book/security.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,15 @@ look like:
11891189
method of an anonymous user object will return true. To check if your
11901190
user is actually authenticated, check for the ``IS_AUTHENTICATED_FULLY``
11911191
role.
1192+
1193+
In a Twig Template this object can be accessed via :class:`Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables`
1194+
1195+
.. configuration-block::
1196+
1197+
.. code-block:: html+jinja
1198+
1199+
<p>Username: {{ app.user.username }}</p>
1200+
11921201

11931202
Using Multiple User Providers
11941203
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)