Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Security] make it possible to configure a custom access decision manager service#19034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[Security] make it possible to configure a custom access decision manager service#19034
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| * | ||
| * @author Christian Flothmann <christian.flothmann@xabbuh.de> | ||
| */ | ||
| class StrategyAwareAccessDecisionManager implements AccessDecisionManagerInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't really like this name. So I welcome any suggestions for something better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm not really sure why you introduced a new class here, it looks like the old class has equal behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If we want to deprecate the old one in favor of this one, I would call itVotingAccessDecisionManager or the like. The special thing about this implementation is that it uses voters to decide the access.
935c6a5 to6ef3459Comparexabbuh commentedJun 12, 2016
I just realised that@hhamon suggested almost the same years ago (see#942) which was closed in favour of creating more specialised access decision managers (though that never happened). What do you think about that idea? Should we create one class per access decision strategy instead and then make it easier to inject your own access decision manager by introducing a new config option in the SecurityBundle? |
xabbuh commentedJun 23, 2016
@symfony/deciders What are your thoughts on this? |
fabpot commentedJun 23, 2016
Not sure if we need to create classes for existing strategies, we could keep them inline as today. If not, I would make those classes final. |
| if ($strategyinstanceof VoteStrategyInterface) { | ||
| $this->voteStrategy =$strategy; | ||
| }elseif (self::STRATEGY_AFFIRMATIVE ===$strategy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
what about deprecating passing a string as strategy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
And maybe removingallowIfAllAbstainDecisions,allowIfEqualGrantedDeniedDecisions from constructor of this class in future?
wouterj commentedJul 2, 2016
I like the idea of having all strategies in seperate classes and configuring the service ID of the strategy to use (with a shortcut for |
wouterj commentedJul 2, 2016
Status: needs work |
xabbuh commentedJul 4, 2016
@wouterj My main concern is if we really need to go the way of custom strategies then or if it wasn't enough to configure a service implementing the |
fabpot commentedNov 9, 2016
@xabbuh Any interest in finishing this one by taking into account comments? |
xabbuh commentedNov 10, 2016
Well, we should first decide which way we would like to go (i.e. making the vote strategy configurable or making it possible to configure the access decision manager like suggested in#942). I think my favourite solution is to keep the separated vote strategies for greater flexibility (as they are now in this PR), but remove the StrategyAwareAccessDecisionManager and instead allow just configure the access decision manager service in the SecurityBundle (you will only be able to configure either the access decision manager or the vote strategy). What do you think? |
wouterj commentedNov 10, 2016
On second thought, I think we should remove the strategy stuff and just allow to configure the AccessDecisionManager service ID. With the VoteStrategyInterface, we add an extra layer of complexity for almost nothing. The AccessDecisionManager simply only proxies it's So simply creating a custom manager and setting it through a service should be more than enough. |
6ef3459 to7ec99f0Compare6417e74 toc28ca0aComparexabbuh commentedNov 28, 2016
I pushed an update that reverts the changes made to the |
xabbuh commentedDec 14, 2016
ping @symfony/deciders |
HeahDude commentedDec 17, 2016
Does it make sense to keep the strategy configurable for a custom access decision manager as a service? |
xabbuh commentedDec 17, 2016
@HeahDude I first thought when I introduced the |
c28ca0a to4abe705Comparexabbuh commentedDec 27, 2016
Status: Needs Review |
099c769 to9a8779fCompare
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍
9a8779f to1d5a5c6Comparenicolas-grekas commentedApr 28, 2017
Moving to milestone as this is not a blocker for 3.3. If you don't agree, please explain why. |
1d5a5c6 toba9fd2fComparexabbuh commentedJun 3, 2017
PR description updated to match the actual state of this PR (the idea of a |
ba9fd2f toe0913a2Comparenicolas-grekas commentedJul 12, 2017
ping @symfony/deciders |
nicolas-grekas commentedJul 12, 2017
Thank you@xabbuh. |
nicolas-grekas commentedJul 12, 2017
Doc PR welcomed ;) |
…ss decision manager service (xabbuh)This PR was merged into the 3.4 branch.Discussion----------[Security] make it possible to configure a custom access decision manager service| Q | A || --- | --- || Branch? | 3.4 || Bug fix? | no || New feature? | yes || BC breaks? | no || Deprecations? | no || Tests pass? | yes || Fixed tickets |#942,#14049,#15295,#16828,#16843, || License | MIT || Doc PR | TODO |These changes will make it possible to let users define their own voting strategies without the need for custom compiler passes that replace the built-in `AccessDecisionManager` (see linked issues in the PR table for some use cases).Commits-------e0913a2 add option to define the access decision manager
Uh oh!
There was an error while loading.Please reload this page.
These changes will make it possible to let users define their own voting strategies without the need for custom compiler passes that replace the built-in
AccessDecisionManager(see linked issues in the PR table for some use cases).