Skip to content

Commit 206e613

Browse files
committed
bug #4304 [DX] Suggest a hint to any auth-check (larsborn)
This PR was submitted for the 2.5 branch but it was merged into the 2.3 branch instead (closes #4304). Discussion ---------- [DX] Suggest a hint to any auth-check Suggest a hint that you need a minimum of auth-check to let the voters vote. Commits ------- ccdda87 Suggest a hint to any auth-check
2 parents a801d57 + ccdda87 commit 206e613

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

cookbook/security/voters.rst

+30
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,36 @@ application configuration file with the following code.
198198
That's it! Now, when deciding whether or not a user should have access,
199199
the new voter will deny access to any user in the list of blacklisted IPs.
200200

201+
Note that the voters are only called, if any access is actually checked. So
202+
you need at least something like
203+
204+
.. configuration-block::
205+
206+
.. code-block:: yaml
207+
208+
# app/config/security.yml
209+
security:
210+
access_control:
211+
- { path: ^/, role: IS_AUTHENTICATED_ANONYMOUSLY }
212+
213+
.. code-block:: xml
214+
215+
<!-- app/config/security.xml -->
216+
<config>
217+
<access-control>
218+
<rule path="^/" role="IS_AUTHENTICATED_ANONYMOUSLY" />
219+
</access-control>
220+
</config>
221+
222+
.. code-block:: php
223+
224+
// app/config/security.xml
225+
$container->loadFromExtension('security', array(
226+
'access_control' => array(
227+
array('path' => '^/', 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY'),
228+
),
229+
));
230+
201231
.. seealso::
202232

203233
For a more advanced usage see

0 commit comments

Comments
 (0)