-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] allow arbitrary types in VoterInterface::vote() #16754
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,10 +31,10 @@ interface VoterInterface | |
* ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN. | ||
* | ||
* @param TokenInterface $token A TokenInterface instance | ||
* @param object|null $object The object to secure | ||
* @param mixed $subject The subject to secure | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a BC break for existing voters, as they must now be written in a way accepting any kind of value here, not just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that BC break is intended so that the interface actually allows to be used like the new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and by the way, it's added to the upgrade file |
||
* @param array $attributes An array of attributes associated with the method being invoked | ||
* | ||
* @return int either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED | ||
*/ | ||
public function vote(TokenInterface $token, $object, array $attributes); | ||
public function vote(TokenInterface $token, $subject, array $attributes); | ||
} |
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.
The
object
variable should probably be renamed tosubject
too. But that should be done in2.8
and we should throw a deprecation when accessingobject
. Would that actually be possible?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.
Adding
subject
along sideobject
in 2.8 is a good idea. Throwing a deprecation notice is possible, but not trivial.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.
Okay, renamed
object
tosubject
here and introduced a newsubject
variable in #16755.