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] improve VoteObject adding extraData for give more possibilities to AccessDecicsionStrategy #60085

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

Open
wants to merge 1 commit into
base: 7.4
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from all commits
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
improveVoteObject
  • Loading branch information
eltharin committed Mar 31, 2025
commit 8f4be1b554f56d37310d045e1916e412976b7446
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function decide(TokenInterface $token, array $attributes, mixed $object =
try {
return $accessDecision->isGranted = $this->strategy->decide(
$this->collectResults($token, $attributes, $object, $accessDecision)
, $accessDecision
);
} finally {
array_pop($this->accessDecisionStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Component\Security\Core\Authorization\Strategy;

use Symfony\Component\Security\Core\Authorization\AccessDecision;

/**
* A strategy for turning a stream of votes into a final decision.
*
Expand All @@ -21,5 +23,5 @@ interface AccessDecisionStrategyInterface
/**
* @param \Traversable<int> $results
*/
public function decide(\Traversable $results): bool;
public function decide(\Traversable $results, /* AccessDecision $accessDecision = null */): bool;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class Vote
*/
public array $reasons = [];

public array|object|null $extraData = null;

public function addReason(string $reason): void
{
$this->reasons[] = $reason;
Expand Down
1 change: 1 addition & 0 deletions 1 src/Symfony/Component/Security/Core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ CHANGELOG
* Add ability for voters to explain their vote
* Add support for voting on closures
* Add `OAuth2User` with OAuth2 Access Token Introspection support for `OAuth2TokenHandler`
* Add extraData in Vote object and pass it to AccessStrategy

7.2
---
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.