-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Fixed some issues of the AccessDecisionManager profiler #18934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7721ba4
639c8ea
16dd82b
ec9ffeb
2ee2361
800ef55
e4cbf01
5d96ec6
804fcec
e3c9c29
82f0541
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,17 +26,19 @@ class DebugAccessDecisionManager implements AccessDecisionManagerInterface | |
{ | ||
private $manager; | ||
private $strategy; | ||
private $voters; | ||
private $voters = array(); | ||
private $decisionLog = array(); | ||
|
||
public function __construct(AccessDecisionManager $manager) | ||
public function __construct(AccessDecisionManagerInterface $manager) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the retrieval of the strategy with reflection below should check for being an instance of AccessDecisionManager though (btw, the ReflectionProperty should use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 I didn't see this PR, so in case it helps: 3.1...Ener-Getick:SECURITY |
||
{ | ||
$this->manager = $manager; | ||
|
||
// The strategy is stored in a private property of the decorated service | ||
$reflection = new \ReflectionProperty($manager, 'strategy'); | ||
$reflection->setAccessible(true); | ||
$this->strategy = $reflection->getValue($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); | ||
} | ||
} | ||
|
||
/** | ||
|
@@ -60,6 +62,10 @@ public function decide(TokenInterface $token, array $attributes, $object = null) | |
*/ | ||
public function setVoters(array $voters) | ||
{ | ||
if (!$this->manager instanceof AccessDecisionManager) { | ||
return; | ||
} | ||
|
||
$this->voters = $voters; | ||
$this->manager->setVoters($voters); | ||
} | ||
|
@@ -72,7 +78,7 @@ 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 strtolower(substr($this->strategy, 6)); | ||
return null === $this->strategy ? '-' : strtolower(substr($this->strategy, 6)); | ||
} | ||
|
||
/** | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the compiler pass was removed then when this argument is changed by
debug.security.access.decision_manager
?I missing something ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yceruto the service is decorated when debug is on by loading
security_debug.xml
.