Skip to content

Commit ee1b59e

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: [Security] Mention the feature to use a custom AccessDecisionManager [Console] Update input.rst
2 parents 89382cf + c6b6107 commit ee1b59e

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

console/input.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ There are three argument variants you can use:
104104
The argument can contain any number of values. For that reason, it must be
105105
used at the end of the argument list.
106106

107-
You can combine ``IS_ARRAY`` with ``REQUIRED`` and ``OPTIONAL`` like this::
107+
You can combine ``IS_ARRAY`` with ``REQUIRED`` or ``OPTIONAL`` like this::
108108

109109
$this
110110
// ...

security/voters.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,49 @@ security configuration:
313313
'allow_if_all_abstain' => false,
314314
],
315315
]);
316+
317+
Custom Access Decision Strategy
318+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
319+
320+
If none of the built-in strategies fits your use case, define the ``service``
321+
option to use a custom service as the Access Decision Manager (your service
322+
must implement the :class:`Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManagerInterface`):
323+
324+
.. configuration-block::
325+
326+
.. code-block:: yaml
327+
328+
# app/config/security.yml
329+
security:
330+
access_decision_manager:
331+
service: App\Security\MyCustomAccessDecisionManager
332+
# ...
333+
334+
.. code-block:: xml
335+
336+
<!-- app/config/security.xml -->
337+
<?xml version="1.0" encoding="UTF-8" ?>
338+
<srv:container xmlns="http://symfony.com/schema/dic/security"
339+
xmlns:srv="http://symfony.com/schema/dic/services"
340+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
341+
xsi:schemaLocation="http://symfony.com/schema/dic/services
342+
https://symfony.com/schema/dic/services/services-1.0.xsd"
343+
>
344+
345+
<config>
346+
<access-decision-manager
347+
service="App\Security\MyCustomAccessDecisionManager"/>
348+
</config>
349+
</srv:container>
350+
351+
.. code-block:: php
352+
353+
// app/config/security.php
354+
use App\Security\MyCustomAccessDecisionManager;
355+
356+
$container->loadFromExtension('security', [
357+
'access_decision_manager' => [
358+
'service' => MyCustomAccessDecisionManager::class,
359+
// ...
360+
],
361+
]);

0 commit comments

Comments
 (0)