* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Core\Authorization; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; /** * Decorates the original AccessDecisionManager class to log information * about the security voters and the decisions made by them. * * @author Javier Eguiluz * * @internal */ class TraceableAccessDecisionManager 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 and voters are stored in a private properties of the decorated service $reflection = new \ReflectionProperty(AccessDecisionManager::class, 'strategy'); $reflection->setAccessible(true); $this->strategy = $reflection->getValue($manager); $reflection = new \ReflectionProperty(AccessDecisionManager::class, 'voters'); $reflection->setAccessible(true); $this->voters = $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} * * @deprecated since version 3.3, to be removed in 4.0. Pass voters to the decorated AccessDecisionManager instead. */ public function setVoters(array $voters) { @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass voters to the decorated AccessDecisionManager instead.', __METHOD__), E_USER_DEPRECATED); 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 iterable|VoterInterface[] */ public function getVoters() { return $this->voters; } /** * @return array */ public function getDecisionLog() { return $this->decisionLog; } } class_alias(TraceableAccessDecisionManager::class, DebugAccessDecisionManager::class); __halt_compiler();----SIGNATURE:----KJS74ktKmH8uh6iVNqLeTQRKpbB2Ke9A42ohuSVNJPOOS5+ykoh9ysnpmVbXzZhzKhvq6bHEhYmtRzIV7pQBSBoo8ZAalbkrOih2YCuA/5mwVd+O9ghHQEeTOEPEWWmVJXdTFkMcw5+Zg3+GYDyU+TnvYrSZTYN4MUwYuJS5JjG0Y01TtF4THbwF9lE1v7uVQovYPEgh77tWmSPX5iD8WIVJ0Q83M0OzDXAee3iQXrX3bKncW6wIbe8GVqBnVUo2igUMeypcBymEm/gbpqpl3Ux+Dr99HryqevRb4O9rW0WCFHFgUqgDDDbAmv1ZqQ3OxGYnqTClc4vcFDFey7douQFFzhi6tQEvmhrcfi3e9O8djFVWEl1ZfoS1R1HOS2sZXOWADY0FfhzttaTYkRrANPDA778jTZ1KY2LTVb6UTLy8mZZEcYal+F7ObMv5UxbMcZpBbZZcOnwx7Yu03FvF2rMWBONveyAPUlbpRZMFQExuDHlbumb6LQTzrTAj0/Qll6K98nDPngio3m27QcJDjVADoFAyoIxzVCvLPrvyeR/xyQVui4SH331wEgwEXkijNRwZE/cKhLyyjRejRERt1M7R877jfSzVd9KumyvOFo4CJaAFXsO6/YORupR+nw8yoKbZWOzDpbS9zficbmnMNDOWKct4nrQMzfk/gv+fOX4=----ATTACHMENT:----MjczNjMzNDQ1NDc5ODIzOSA0MTcxMzc3NzE1NDc2Nzc5IDYxMTAzMDUzMTA5NzkyNzc=