Skip to content
Merged
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
1 change: 1 addition & 0 deletions UPGRADE-7.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Security
* Deprecate `AbstractListener::__invoke`
* Deprecate `LazyFirewallContext::__invoke()`
* Deprecate `PersistentTokenInterface::getClass()` and `RememberMeDetails::getUserFqcn()`, the user FQCN will be removed from the remember-me cookie in 8.0
* Add argument `$accessDecision` to `AccessDecisionStrategyInterface::decide()`;

Serializer
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public function decide(TokenInterface $token, array $attributes, mixed $object =

try {
return $accessDecision->isGranted = $this->strategy->decide(
$this->collectResults($token, $attributes, $object, $accessDecision)
$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 @@ -20,6 +22,7 @@ interface AccessDecisionStrategyInterface
{
/**
* @param \Traversable<int> $results
* @param ?AccessDecision $accessDecision
*/
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 @@ -11,6 +11,7 @@

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

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

/**
Expand All @@ -29,7 +30,7 @@ public function __construct(
) {
}

public function decide(\Traversable $results): bool
public function decide(\Traversable $results, ?AccessDecision $accessDecision = null): bool
{
$deny = 0;
foreach ($results as $result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

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

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

/**
Expand Down Expand Up @@ -38,7 +39,7 @@ public function __construct(
) {
}

public function decide(\Traversable $results): bool
public function decide(\Traversable $results, ?AccessDecision $accessDecision = null): bool
{
$grant = 0;
$deny = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

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

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

/**
Expand All @@ -30,7 +31,7 @@ public function __construct(
) {
}

public function decide(\Traversable $results): bool
public function decide(\Traversable $results, ?AccessDecision $accessDecision = null): bool
{
foreach ($results as $result) {
if (VoterInterface::ACCESS_GRANTED === $result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

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

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

/**
Expand All @@ -29,7 +30,7 @@ public function __construct(
) {
}

public function decide(\Traversable $results): bool
public function decide(\Traversable $results, ?AccessDecision $accessDecision = null): bool
{
$grant = 0;
foreach ($results as $result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ class Vote
*/
public array $reasons = [];

/**
* @var array<string, mixed>
*/
public array $extraData = [];

public function addReason(string $reason): void
{
$this->reasons[] = $reason;
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Security/Core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CHANGELOG

* Add `MermaidDumper` to dump Role Hierarchy graphs in the Mermaid.js flowchart format
* Deprecate `PersistentTokenInterface::getClass()`, the user class will be removed from the remember-me cookie in 8.0
* Add `extraData` property to `Vote` objects
* Add argument `$accessDecision` to `AccessDecisionStrategyInterface`

7.3
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecision;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
use Symfony\Component\Security\Core\Authorization\Strategy\AccessDecisionStrategyInterface;
use Symfony\Component\Security\Core\Authorization\Voter\CacheableVoterInterface;
Expand All @@ -40,7 +41,7 @@ public function testVoterCalls()
];

$strategy = new class implements AccessDecisionStrategyInterface {
public function decide(\Traversable $results): bool
public function decide(\Traversable $results, ?AccessDecision $accessDecision = null): bool
{
$i = 0;
foreach ($results as $result) {
Expand Down
Loading