diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index 6d39cee8ec3..9cdfd545f38 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -197,6 +197,36 @@ application configuration file with the following code. That's it! Now, when deciding whether or not a user should have access, the new voter will deny access to any user in the list of blacklisted IPs. +Note that the voters are only called, if any access is actually checked. So +you need at least something like + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/security.yml + security: + access_control: + - { path: ^/, role: IS_AUTHENTICATED_ANONYMOUSLY } + + .. code-block:: xml + + + + + + + + + .. code-block:: php + + // app/config/security.xml + $container->loadFromExtension('security', array( + 'access_control' => array( + array('path' => '^/', 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY'), + ), + )); + .. seealso:: For a more advanced usage see