diff options
author | Nicolas Grekas <nicolas.grekas@gmail.com> | 2017-01-03 10:52:33 +0100 |
---|---|---|
committer | Nicolas Grekas <nicolas.grekas@gmail.com> | 2017-01-03 10:52:33 +0100 |
commit | 43d87514e9ef2f05c6b70f5e9fa57af9eb74bc12 (patch) | |
tree | d97f5135e5bea364fea008b4ce13b20e5d4f8e23 /Core/Authorization/DebugAccessDecisionManager.php | |
parent | d8ef1285ab7a57971090fb70449a4098f2cb7ac9 (diff) | |
parent | 866bd6fe7d3b62a0d1c671a2b340aee73241a095 (diff) | |
download | symfony-security-43d87514e9ef2f05c6b70f5e9fa57af9eb74bc12.zip symfony-security-43d87514e9ef2f05c6b70f5e9fa57af9eb74bc12.tar.gz symfony-security-43d87514e9ef2f05c6b70f5e9fa57af9eb74bc12.tar.bz2 |
minor #21088 Rename DebugAccessDecisionManager to TraceableAccessDecisionManager (Jean85)
This PR was squashed before being merged into the 3.3-dev branch (closes #21088).
Discussion
----------
Rename DebugAccessDecisionManager to TraceableAccessDecisionManager
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21085
| License | MIT
[EDIT] No longer WIP, test passing. Also, test added to preserve BC with the SecurityBundle.
Commits
-------
c5e0e59 Rename DebugAccessDecisionManager to TraceableAccessDecisionManager
Diffstat (limited to 'Core/Authorization/DebugAccessDecisionManager.php')
-rw-r--r-- | Core/Authorization/DebugAccessDecisionManager.php | 88 |
1 files changed, 6 insertions, 82 deletions
diff --git a/Core/Authorization/DebugAccessDecisionManager.php b/Core/Authorization/DebugAccessDecisionManager.php index 219ca76..59a4796 100644 --- a/Core/Authorization/DebugAccessDecisionManager.php +++ b/Core/Authorization/DebugAccessDecisionManager.php @@ -11,88 +11,12 @@ namespace Symfony\Component\Security\Core\Authorization; -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; - -/** - * Decorates the original AccessDecisionManager class to log information - * about the security voters and the decisions made by them. +/* + * @internal * - * @author Javier Eguiluz <javier.eguiluz@gmail.com> + * @deprecated The DebugAccessDecisionManager class has been renamed and is deprecated since version 3.3 and will be removed in 4.0. Use the TraceableAccessDecisionManager class instead. * - * @internal + * This is a placeholder for the old class, that got renamed; this is not a BC break since the class is internal, this + * placeholder is here just to help backward compatibility with older SecurityBundle versions. */ -class DebugAccessDecisionManager implements AccessDecisionManagerInterface -{ - private $manager; - private $strategy; - private $voters = array(); - private $decisionLog = array(); - - public function __construct(AccessDecisionManagerInterface $manager) - { - $this->manager = $manager; - - if ($this->manager instanceof AccessDecisionManager) { - // The strategy is stored in a private property of the decorated service - $reflection = new \ReflectionProperty(AccessDecisionManager::class, 'strategy'); - $reflection->setAccessible(true); - $this->strategy = $reflection->getValue($manager); - } - } - - /** - * {@inheritdoc} - */ - public function decide(TokenInterface $token, array $attributes, $object = null) - { - $result = $this->manager->decide($token, $attributes, $object); - - $this->decisionLog[] = array( - 'attributes' => $attributes, - 'object' => $object, - 'result' => $result, - ); - - return $result; - } - - /** - * {@inheritdoc} - */ - public function setVoters(array $voters) - { - if (!method_exists($this->manager, 'setVoters')) { - return; - } - - $this->voters = $voters; - $this->manager->setVoters($voters); - } - - /** - * @return string - */ - public function getStrategy() - { - // The $strategy property is misleading because it stores the name of its - // method (e.g. 'decideAffirmative') instead of the original strategy name - // (e.g. 'affirmative') - return null === $this->strategy ? '-' : strtolower(substr($this->strategy, 6)); - } - - /** - * @return array - */ - public function getVoters() - { - return $this->voters; - } - - /** - * @return array - */ - public function getDecisionLog() - { - return $this->decisionLog; - } -} +class_exists(TraceableAccessDecisionManager::class); |