Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.

New in Symfony 4.2: Detailed security voters decisions

Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.

Contributed by
Laurent Voullemier
in #27914.

Security voters are the key feature of Symfony's authorization mechanism. They provide the most granular way of checking permissions (e.g. "can this specific user edit the given item?").

In order to grant or deny permission, all the voters' decisions are aggregated by the Access Decision Manager. Then, depending on your application config, permission is granted if all voters said yes (unanimous), or if the majority said yes (consensus), or if at least one voter said yes (affirmative).

Sometimes, when your security logic is complex, you may need to know exactly why some permission was granted. Symfony Profiler already shows some details about voters:

However, the information is not as detailed as it should be. In Symfony 4.2, we improved this panel to display all the information available about the voters decisions and not only the aggregated results:

Help the Symfony project!

As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.

Comments

Nice one! Good job!
Thanks Laurent ! Nice feature.
This is the kind of improvement that makes Symfony one of the best PHP framework. Good job again ! 👌

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.