@@ -149,86 +149,3 @@ and tag it as a ``security.voter``:
149149 configuration file (e.g. ``app/config/config.yml ``). For more information
150150 see :ref: `service-container-imports-directive `. To read more about defining
151151 services in general, see the :doc: `/book/service_container ` chapter.
152-
153- .. _security-voters-change-strategy :
154-
155- Changing the Access Decision Strategy
156- -------------------------------------
157-
158- In order for the new voter to take effect, you need to change the default access
159- decision strategy, which, by default, grants access if *any * voter grants
160- access.
161-
162- In this case, choose the ``unanimous `` strategy. Unlike the ``affirmative ``
163- strategy (the default), with the ``unanimous `` strategy, if only one voter
164- denies access (e.g. the ``ClientIpVoter ``), access is not granted to the
165- end user.
166-
167- To do that, override the default ``access_decision_manager `` section of your
168- application configuration file with the following code.
169-
170- .. configuration-block ::
171-
172- .. code-block :: yaml
173-
174- # app/config/security.yml
175- security :
176- access_decision_manager :
177- # strategy can be: affirmative, unanimous or consensus
178- strategy : unanimous
179-
180- .. code-block :: xml
181-
182- <!-- app/config/security.xml -->
183- <config >
184- <!-- strategy can be: affirmative, unanimous or consensus -->
185- <access-decision-manager strategy =" unanimous" >
186- </config >
187-
188- .. code-block :: php
189-
190- // app/config/security.xml
191- $container->loadFromExtension('security', array(
192- // strategy can be: affirmative, unanimous or consensus
193- 'access_decision_manager' => array(
194- 'strategy' => 'unanimous',
195- ),
196- ));
197-
198- That's it! Now, when deciding whether or not a user should have access,
199- the new voter will deny access to any user in the list of blacklisted IPs.
200-
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-
231- .. seealso ::
232-
233- For a more advanced usage see
234- :ref: `components-security-access-decision-manager `.
0 commit comments