Permalink
Browse files

minor #4551 Normalize the method listings on version 2.5 (pedronofuen…

…tes)

This PR was squashed before being merged into the 2.5 branch (closes #4551).

Discussion
----------

Normalize the method listings on version 2.5

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | no
| Applies to    | 2.5
| Fixed tickets | #3903

This pull request is related with #4539. Normalizes listings from 2.5

Commits
-------

2665407 Normalize the method listings on version 2.5
  • Loading branch information...
wouterj committed Dec 17, 2014
2 parents c5d2eb8 + 2665407 commit 815e0bf97745c7cbd56852ed5ef5639dc3ddb309
Showing with 35 additions and 25 deletions.
  1. +6 −4 book/routing.rst
  2. +25 −19 book/security.rst
  3. +4 −2 book/service_container.rst
@@ -967,10 +967,12 @@ header matches ``firefox``.
You can do any complex logic you need in the expression by leveraging two
variables that are passed into the expression:
* ``context``: An instance of :class:`Symfony\\Component\\Routing\\RequestContext`,
which holds the most fundamental information about the route being matched;
* ``request``: The Symfony :class:`Symfony\\Component\\HttpFoundation\\Request`
object (see :ref:`component-http-foundation-request`).
``context``
An instance of :class:`Symfony\\Component\\Routing\\RequestContext`, which
holds the most fundamental information about the route being matched.
``request``
The Symfony :class:`Symfony\\Component\\HttpFoundation\\Request` object
(see :ref:`component-http-foundation-request`).
.. caution::
@@ -1922,28 +1922,34 @@ syntax, see :doc:`/components/expression_language/syntax`.
Inside the expression, you have access to a number of variables:
* ``user`` The user object (or the string ``anon`` if you're not authenticated);
* ``roles`` The array of roles the user has, including from the
:ref:`role hierarchy <book-security-role-hierarchy>` but not including
the ``IS_AUTHENTICATED_*`` attributes (see the functions below);
* ``object``: The object (if any) that's passed as the second argument to
``isGranted`` ;
* ``token`` The token object;
* ``trust_resolver``: The :class:`Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolverInterface`,
object: you'll probably use the ``is_*`` functions below instead.
``user``
The user object (or the string ``anon`` if you're not authenticated).
``roles``
The array of roles the user has, including from the
:ref:`role hierarchy <book-security-role-hierarchy>` but not including the
``IS_AUTHENTICATED_*`` attributes (see the functions below).
``object``
The object (if any) that's passed as the second argument to ``isGranted``.
``token``
The token object.
``trust_resolver``
The :class:`Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolverInterface`,
object: you'll probably use the ``is_*`` functions below instead.
Additionally, you have access to a number of functions inside the expression:
* ``is_authenticated``: Returns ``true`` if the user is authenticated via "remember-me"
or authenticated "fully" - i.e. returns true if the user is "logged in";
* ``is_anonymous``: Equal to using ``IS_AUTHENTICATED_ANONYMOUSLY`` with
the ``isGranted`` function;
* ``is_remember_me``: Similar, but not equal to ``IS_AUTHENTICATED_REMEMBERED``,
see below;
* ``is_fully_authenticated``: Similar, but not equal to ``IS_AUTHENTICATED_FULLY``,
see below;
* ``has_role``: Checks to see if the user has the given role - equivalent
to an expression like ``'ROLE_ADMIN' in roles``.
``is_authenticated``
Returns ``true`` if the user is authenticated via "remember-me" or authenticated
"fully" - i.e. returns true if the user is "logged in".
``is_anonymous``
Equal to using ``IS_AUTHENTICATED_ANONYMOUSLY`` with the ``isGranted`` function.
``is_remember_me``
Similar, but not equal to ``IS_AUTHENTICATED_REMEMBERED``, see below.
``is_fully_authenticated``
Similar, but not equal to ``IS_AUTHENTICATED_FULLY``, see below.
``has_role``
Checks to see if the user has the given role - equivalent to an expression like
``'ROLE_ADMIN' in roles``.
.. sidebar:: ``is_remember_me`` is different than checking ``IS_AUTHENTICATED_REMEMBERED``
@@ -673,8 +673,10 @@ To learn more about the expression language syntax, see :doc:`/components/expres
In this context, you have access to 2 functions:
* ``service`` - returns a given service (see the example above);
* ``parameter`` - returns a specific parameter value (syntax is just like ``service``)
``service``
Returns a given service (see the example above).
``parameter``
Returns a specific parameter value (syntax is just like ``service``).
You also have access to the :class:`Symfony\\Component\\DependencyInjection\\ContainerBuilder`
via a ``container`` variable. Here's another example:

0 comments on commit 815e0bf

Please sign in to comment.