Skip to content

Commit 6293478

Browse files
sarbanhachalasr
authored andcommitted
[Security] TraceableAccessDecisionManager: fix inspecting voters of custom access decision managers
1 parent 758196d commit 6293478

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Authorization/TraceableAccessDecisionManager.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ public function __construct(AccessDecisionManagerInterface $manager)
3636
{
3737
$this->manager = $manager;
3838

39-
if ($this->manager instanceof AccessDecisionManager) {
40-
// The strategy and voters are stored in a private properties of the decorated service
41-
$reflection = new \ReflectionProperty(AccessDecisionManager::class, 'strategy');
39+
// The strategy and voters are stored in a private properties of the decorated service
40+
if (property_exists($manager, 'strategy')) {
41+
$reflection = new \ReflectionProperty(\get_class($manager), 'strategy');
4242
$this->strategy = $reflection->getValue($manager);
43-
$reflection = new \ReflectionProperty(AccessDecisionManager::class, 'voters');
43+
}
44+
if (property_exists($manager, 'voters')) {
45+
$reflection = new \ReflectionProperty(\get_class($manager), 'voters');
4446
$this->voters = $reflection->getValue($manager);
4547
}
4648
}

0 commit comments

Comments
 (0)