-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Rename DebugAccessDecisionManager to TraceableAccessDecisionManager #21088
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
Conversation
Tests seem to pass on Travis. So maybe a local problem? I think you're correct about not having to care about BC here as it's status: reviewed (btw, you can ignore fabbot.io's coding style error) |
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.
We need to keep the old class name (possibly through a class alias). Otherwise, older versions of the SecurityBundle would break when being used with 3.3/3.4 versions of the Security Core component. We should probably add a test case (the fact that the build suite passed indicates that we are not testing anything/the right thing here).
Well, it was not a local error but a fail of the Travis build on my fork, here: https://travis-ci.org/Jean85/symfony/builds/187412622 If we need a BC class, I will add it. In fact, mixing versions of the bundles may break stuff like in my build, you're right! |
*/ | ||
class DebugAccessDecisionManager implements AccessDecisionManagerInterface | ||
class DebugAccessDecisionManager extends TraceableAccessDecisionManager |
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.
What about using the same approach that @nicolas-grekas used in #20967 instead?
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.
Nice! Doing it RN!
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.
Test failing locally... Maybe I'm missing something, but how is it supposed to work like that? It's defining the alias before declaring the class, it says that the Traceable class is missing!
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.
Can you push your latest commit so we can take a look at it?
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.
Pushed!
|
||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; | ||
|
||
class_alias(TraceableAccessDecisionManager::class, DebugAccessDecisionManager::class); |
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.
moving this line after the class definition should make tests green
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.
I've chosen a different approach: I've removed the class_exist
(since it seems useless to me) and I've moved it into the deprecated file, which seems the right place to me.
Latests commits are coming from the discussion with @nicolas-grekas in #21096. |
@Jean85 In your test, the |
You're right; I've tested locally and it works even if I launch the single tests method, so it's just a test issue, to avoid future regressions. Maybe it's better if I move the tests to the top of the class, and I use a simple |
I've reverted to the suggested approach, an rewrote the test to avoid triggering the autoload of the deprecated class. Sorry if I was so stubborn @xabbuh , now I've rewritten the test to show how my approach was flawed. PHPUnit's |
@@ -40,4 +41,16 @@ public function provideObjectsAndLogs() | |||
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $x = array(), 'result' => false)), $x); | |||
yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $object, 'result' => false)), $object); | |||
} | |||
|
|||
/** | |||
* @group this |
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.
should be removed
@Jean85 Don't worry about that. Renaming is actually not so easy and it's always good to think about the approaches we use. |
Thanks! I've removed the annotation that I left behind by mistake! |
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.
👍 with minor changes
* about the security voters and the decisions made by them. | ||
* | ||
* @author Javier Eguiluz <javier.eguiluz@gmail.com> | ||
* @author Alessandro Lai <alessandro.lai85@gmail.com> |
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.
you should remove this line, there is no authorship to claim here: git will record your contribution
* | ||
* @internal | ||
* @deprecated The DebugAccessDecisionManager class is deprecated since version 3.3 and will be removed in 4.0. Use the Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager class instead. |
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.
the namespace could be removed
{ | ||
$adm = new TraceableAccessDecisionManager(new AccessDecisionManager()); | ||
|
||
if (! $adm instanceof DebugAccessDecisionManager) { |
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.
extra space to be removed after !
$adm = new TraceableAccessDecisionManager(new AccessDecisionManager()); | ||
|
||
if (! $adm instanceof DebugAccessDecisionManager) { | ||
$this->fail('Doesn\'t work, BC with SecurityBundle broken, see PR #21088'); |
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.
we don't reference github, git blame
is used instead to look for historical things. I propose:
$this->fail('For BC, TraceableAccessDecisionManager must be an instance of DebugAccessDecisionManager');
Fixes committed! The style checker is having some false positive I think... |
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ |
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.
This should IMO not be removed.
@xabbuh done! |
👍 Status: Reviewed |
Thank you @Jean85. |
…sionManager (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
[EDIT] No longer WIP, test passing. Also, test added to preserve BC with the SecurityBundle.