-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Make it possible to give voters a weight in consensus decisions #16828
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5589e87
to
cb4a18e
Compare
} | ||
|
||
if ($weight < 1) { | ||
throw new RuntimeException( |
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.
Please put this in one single line.
👍 but this PR should be merged to master, as of 2.8 is already released. |
@dosten If I read http://symfony.com/doc/master/contributing/code/patches.html#choose-the-right-branch correctly, a BC compatible feature should be compared against the 2.8 branch. |
deccf70
to
17da1f4
Compare
@tPl0ch 2.8 is already released, so no new features are accepted, only bug fixes, same for 3.0. This new feature must be merged in master to be included in the 3.1 release. |
final class Weight implements WeightedVoterInterface | ||
{ | ||
private $voter; | ||
|
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.
We do not keep spaces between variables.
…sions After watching the "Dig in Security with Symfony" talk at SymfonyCon today, I realized that there was no weighting mechanism in the current implementation. It is not always true that each voter has the equal weight within a majority vote. This feature PR accounts for that in a BC way. | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | None | License | MIT | Doc PR | None Commit recap from rebase: - Introduced the `WeightedVoterInterface` that extends the `VoterInterface` - Added the abstract `WeightedVoter` as an easily usable base class - Added the `Weight` decorator to extend existing Voters with weighting - Refactored test structures for `Voter` - Added missing methods in `Weight` decorator required by `VoterInterface` - Added test case for `Weight` decorator - Added test case for abstract `WeightedVoter` - Added feature tests to `AccessDecisionManagerTest` - Implemented feature in `AccessDecisionManager` - Fixed CodingStandards
17da1f4
to
8160138
Compare
@dosten So closing this in favour of a PR against master. |
…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
After watching the "Dig in Security with Symfony" talk at SymfonyCon today, I
realized that there was no weighting mechanism in the current implementation.
It is not always true that each voter has the equal weight within a majority
vote. This feature PR accounts for that in a BC way.
Commit recap from rebase:
WeightedVoterInterface
that extends theVoterInterface
WeightedVoter
as an easily usable base classWeight
decorator to extend existing Voters with weightingVoter
Weight
decorator required byVoterInterface
Weight
decoratorWeightedVoter
AccessDecisionManagerTest
AccessDecisionManager