10000 [Security][SecurityBundle] Add messages and score on votes by eltharin · Pull Request #58107 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security][SecurityBundle] Add messages and score on votes #58107

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 12 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
change tests
  • Loading branch information
eltharin committed Feb 10, 2025
commit 7abffb178561c93b8cd0bf4852fdf72e44cbe420
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public static function provideObjectsAndLogs(): \Generator
['ATTRIBUTE_1'],
null,
[
[$voter1, VoterInterface::ACCESS_GRANTED],
[$voter2, VoterInterface::ACCESS_GRANTED],
[$voter1, new Vote(VoterInterface::ACCESS_GRANTED)],
[$voter2, new Vote(VoterInterface::ACCESS_GRANTED)],
],
$result,
];
Expand All @@ -85,15 +85,15 @@ public static function provideObjectsAndLogs(): \Generator
'object' => true,
'result' => $result = new AccessDecision(VoterInterface::ACCESS_DENIED),
'voterDetails' => [
['voter' => $voter1, 'attributes' => ['ATTRIBUTE_1', 'ATTRIBUTE_2'], 'vote' => new Vote(VoterInterface::ACCESS_ABSTAIN)],
['voter' => $voter1, 'attributes' => ['ATTRIBUTE_1', 'ATTRIBUTE_2'], 'vote' => VoterInterface::ACCESS_ABSTAIN],
['voter' => $voter2, 'attributes' => ['ATTRIBUTE_1', 'ATTRIBUTE_2'], 'vote' => new Vote(VoterInterface::ACCESS_GRANTED)],
],
]],
['ATTRIBUTE_1', 'ATTRIBUTE_2'],
true,
[
[$voter1, VoterInterface::ACCESS_ABSTAIN],
[$voter2, VoterInterface::ACCESS_GRANTED],
[$voter2, new Vote(VoterInterface::ACCESS_GRANTED)],
],
$result,
];
Expand All @@ -110,8 +110,8 @@ public static function provideObjectsAndLogs(): \Generator
[null],
'jolie string',
[
[$voter1, VoterInterface::ACCESS_ABSTAIN],
[$voter2, VoterInterface::ACCESS_DENIED],
[$voter1, new Vote(VoterInterface::ACCESS_ABSTAIN)],
[$voter2, new Vote(VoterInterface::ACCESS_DENIED)],
],
$result,
];
Expand Down Expand Up @@ -152,8 +152,8 @@ public static function provideObjectsAndLogs(): \Generator
['ATTRIBUTE_2'],
$x,
[
[$voter1, VoterInterface::ACCESS_ABSTAIN],
[$voter2, VoterInterface::ACCESS_ABSTAIN],
[$voter1, new Vote(VoterInterface::ACCESS_ABSTAIN)],
[$voter2, new Vote(VoterInterface::ACCESS_ABSTAIN)],
],
$result,
];
Expand All @@ -170,8 +170,8 @@ public static function provideObjectsAndLogs(): \Generator
[12.13],
new \stdClass(),
[
[$voter1, VoterInterface::ACCESS_DENIED],
[$voter2, VoterInterface::ACCESS_DENIED],
[$voter1, new Vote(VoterInterface::ACCESS_DENIED)],
[$voter2, new Vote(VoterInterface::ACCESS_DENIED)],
],
$result,
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function testSwitchUserAlreadySwitched($accessDecisionManager, string $de
$this->request->query->set('_switch_user', 'kuba');

$targetsUser = $this->callback(fn ($user) => 'kuba' === $user->getUserIdentifier());
$this->accessDecisionManager->expects($this->once())
$accessDecisionManager->expects($this->once())
->method($decideFunction)->with(self::callback(function (TokenInterface $token) use ($originalToken, $tokenStorage) {
// the token storage should also contain the original token for voters depending on it
return $token === $originalToken && $tokenStorage->getToken() === $originalToken;
Expand Down
0