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

Commit 17cbdf8

Browse filesBrowse files
committed
voteevent
1 parent 23a03e2 commit 17cbdf8
Copy full SHA for 17cbdf8

File tree

Expand file treeCollapse file tree

3 files changed

+8
-8
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+8
-8
lines changed

‎src/Symfony/Bundle/SecurityBundle/EventListener/VoteListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/EventListener/VoteListener.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public function __construct(
3131

3232
public function onVoterVote(VoteEvent $event): void
3333
{
34-
$this->traceableAccessDecisionManager->addVoterVote($event->getVoter(), $event->getAttributes(), $event->getVote(true));
34+
$voteObj = null;
35+
$vote = $event->getVote($voteObj);
36+
$this->traceableAccessDecisionManager->addVoterVote($event->getVoter(), $event->getAttributes(), $voteObj ?? $vote);
3537
}
3638

3739
public static function getSubscribedEvents(): array

‎src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public function decide(TokenInterface $token, array $attributes, mixed $object =
6868
/**
6969
* Adds voter vote and class to the voter details.
7070
*
71-
* @param array $attributes attributes used for the vote
72-
* @param int $vote vote of the voter
71+
* @param array $attributes attributes used for the vote
72+
* @param VoteInterface|int $vote vote of the voter
7373
*/
7474
public function addVoterVote(VoterInterface $voter, array $attributes, VoteInterface|int $vote): void
7575
{

‎src/Symfony/Component/Security/Core/Event/VoteEvent.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Event/VoteEvent.php
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ public function getAttributes(): array
4747
return $this->attributes;
4848
}
4949

50-
public function getVote($asObject = false): VoteInterface|int
50+
public function getVote(?VoteInterface &$vote = null): int
5151
{
52-
if ($this->vote instanceof VoteInterface && !$asObject) {
53-
return $this->vote->getAccess();
54-
}
52+
$vote = $this->vote;
5553

56-
return $this->vote;
54+
return $this->vote instanceof VoteInterface ? $this->vote->getAccess() : $this->vote;
5755
}
5856
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.