Skip to content

Commit

Permalink
Revert "minor #45899 [Messenger] [Security/Core] Remove legacy class …
Browse files Browse the repository at this point in the history
…aliases (nicolas-grekas)"

This reverts commit 758ed6bf66648a17432496162cd02215b8809df4, reversing
changes made to 1bd3af4ec6303a4cf3de0218abc29ca9fdd7a793.
  • Loading branch information
nicolas-grekas committed Mar 31, 2022
1 parent 6bac15f commit eb2967d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Authorization/TraceableAccessDecisionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,7 @@ public function getDecisionLog(): array
return $this->decisionLog;
}
}

if (!class_exists(DebugAccessDecisionManager::class, false)) {
class_alias(TraceableAccessDecisionManager::class, DebugAccessDecisionManager::class);
}
4 changes: 4 additions & 0 deletions Exception/UserNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ public function __unserialize(array $data): void
parent::__unserialize($parentData);
}
}

if (!class_exists(UsernameNotFoundException::class, false)) {
class_alias(UserNotFoundException::class, UsernameNotFoundException::class);
}
8 changes: 8 additions & 0 deletions Tests/Authorization/TraceableAccessDecisionManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\Authorization\DebugAccessDecisionManager;
use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager;
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;

Expand Down Expand Up @@ -170,6 +171,13 @@ public function provideObjectsAndLogs(): \Generator
];
}

public function testDebugAccessDecisionManagerAliasExistsForBC()
{
$adm = new TraceableAccessDecisionManager(new AccessDecisionManager());

$this->assertInstanceOf(DebugAccessDecisionManager::class, $adm, 'For BC, TraceableAccessDecisionManager must be an instance of DebugAccessDecisionManager');
}

/**
* Tests decision log returned when a voter call decide method of AccessDecisionManager.
*/
Expand Down

0 comments on commit eb2967d

Please sign in to comment.