summaryrefslogtreecommitdiffstats
path: root/Core/Authorization/DebugAccessDecisionManager.php
diff options
context:
space:
mode:
Diffstat (limited to 'Core/Authorization/DebugAccessDecisionManager.php')
-rw-r--r--Core/Authorization/DebugAccessDecisionManager.php88
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);