Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Security] Add the ability for voter to return decision reason #43147

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

Closed
wants to merge 36 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
81f7499
Add the ability for voter to return decision reason
yellow1912 Sep 23, 2021
85a9b3d
Create mock with DecisionManager class
yellow1912 Sep 23, 2021
293a057
Fix phpunit test errors
yellow1912 Sep 23, 2021
66d49ac
Standardize Voter code
yellow1912 Sep 23, 2021
b43c6e5
Remove AccessTrait
yellow1912 Sep 23, 2021
cba2283
Change $access property to private as requested
yellow1912 Sep 23, 2021
6675182
Remove bool return to avoid BC
yellow1912 Sep 23, 2021
c15b796
Fix return typehint for decide method
yellow1912 Sep 23, 2021
7e5feef
Switch to using constructor for Vote
yellow1912 Sep 23, 2021
55bc4cd
Fix AccessDeniedException
yellow1912 Sep 23, 2021
219a3be
Fix coding standards
yellow1912 Sep 23, 2021
8c5fcb0
Fix test results
yellow1912 Sep 23, 2021
d970920
Fix deprecation to match with test
yellow1912 Sep 23, 2021
a9578c4
Fix decide method deprecation test matching
yellow1912 Sep 23, 2021
1357b53
Fix tests in AccessListenerTest
yellow1912 Sep 23, 2021
b949317
Add missing AbstractToken in AccessListenerTest
yellow1912 Sep 23, 2021
6b9ec12
getDecisionLog return object, not boolean
yellow1912 Sep 23, 2021
dfec312
Attempt to fix test in AccessListenerTest
yellow1912 Sep 24, 2021
95e9682
Fix testAccessDecisionManagerCalledByVoter
yellow1912 Sep 24, 2021
282c972
Add mising class in test
yellow1912 Sep 24, 2021
5993a1a
Fix coding standards
yellow1912 Sep 24, 2021
04159fd
Fix issue with final class mock
yellow1912 Sep 24, 2021
8b4430d
Fix issue with final class mock
yellow1912 Sep 24, 2021
e2212f6
Fix issue with final class mock
yellow1912 Sep 24, 2021
4f52a2c
Update version in deprecation message
yellow1912 Sep 24, 2021
de1f7e3
Fix BC with VoteEvent
yellow1912 Sep 24, 2021
7d4e955
Fix deprecation version
yellow1912 Sep 24, 2021
7589a16
Rename vote $reason to $message, $parameters to $context
yellow1912 Sep 24, 2021
8aacd94
Add back return typehint in phpdoc
yellow1912 Sep 24, 2021
d776986
Fix coding standard
yellow1912 Sep 24, 2021
991857d
Add more checkings for deprecation notices inside tests
yellow1912 Sep 26, 2021
504ec26
Merge test code with latest 5.4
yellow1912 Sep 26, 2021
9d59fdd
Allow getAccessDecision to return null in AccessDeniedException
yellow1912 Sep 27, 2021
7a4dc72
Merge security.html.twig with new changes
yellow1912 Oct 15, 2021
93c0c10
Fix coding standards
yellow1912 Oct 17, 2021
5ebf1b5
Add missing dot to comply with standards
yellow1912 Oct 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Standardize Voter code
1. Change internal methods from public to protected
2. Remove useless phpdoc
  • Loading branch information
yellow1912 committed Sep 23, 2021
commit 66d49ac74c7edd22b733428a5f2b433b268d17d5
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ public function vote(TokenInterface $token, $subject, array $attributes)
/**
* Creates a granted vote.
*/
public function grant(string $reason = '', array $parameters = []): Vote
protected function grant(string $reason = '', array $parameters = []): Vote
{
return Vote::createGranted($reason, $parameters);
}

/**
* Creates an abstained vote.
*/
public function abstain(string $reason = '', array $parameters = []): Vote
protected function abstain(string $reason = '', array $parameters = []): Vote
{
return Vote::createAbstain($reason, $parameters);
}

/**
* Creates a denied vote.
*/
public function deny(string $reason = '', array $parameters = []): Vote
protected function deny(string $reason = '', array $parameters = []): Vote
{
return Vote::createDenied($reason, $parameters);
}
Expand All @@ -98,7 +98,6 @@ public function deny(string $reason = '', array $parameters = []): Vote
* @param string $attribute An attribute
* @param mixed $subject The subject to secure, e.g. an object the user wants to access or any other PHP type
*
* @return bool True if the attribute and subject are supported, false otherwise
*/
abstract protected function supports(string $attribute, $subject);

Expand All @@ -108,7 +107,7 @@ abstract protected function supports(string $attribute, $subject);
*
* @param mixed $subject
*
* @return Vote Returning a boolean is deprecated since Symfony 5.1. Return a Vote object instead.
* @return Vote Returning a boolean is deprecated since Symfony 5.4. Return a Vote object instead.
*/
abstract protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token);
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.