Override the access decision strategy instead of the manager #7021
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contao is decorating the Symfony access decision manager, because we require to use the priority strategy in our firewall, but we don't want to alter the strategy in a possible firewall outside of Contao. Unfortunately, Symfony does not allow to define the voter strategy per firewall.
Our decoration causes several issues, mostly described in symfony/symfony#54225. A quick fix was added in #7008.
Decorating the access decision manager causes all kind of issues in the profiler toolbar. We worked around some by decorating our own access decision manager with the Symfony TraceableAccessDecisionManager in debug mode. But Symfony also decorates all voters automatically to trace the voter definition, and these traced voters are only replaced on the original access decision manager. Our profiler therefore did not show all relevant information.
Because we only need to influence the strategy, we can simply decorate that instead of the full manager. Tracing and everything then works out of the box as usual in Symfony. We can even show the correct strategy in the profiler depending on the firewall context 馃帀
@fritzmg I think that closes symfony/symfony#54225 (at least for us)
Also fixes #6988