-
Notifications
You must be signed in to change notification settings - Fork 570
#729 v3 authorization fail #734
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
| // try/catch/finally instead of expectExcetion | ||
| // to restore `debug` configuration | ||
| try { | ||
| $controller->beforeFilter($event); |
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.
Integration tests generally make requests to the application and check the response contents.
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'm ok with you about testDebugDisabled but for the testSkipAuthorization i should test the AuthorizationService::authorizationChecked() status, and i only can do that thrue controller request.
Any ideas ?
| $this->assertInstanceOf('Cake\Http\Exception\NotFoundException', $e); | ||
| $this->assertSame('Not available without debug mode on.', $e->getMessage()); | ||
| } finally { | ||
| Configure::write('debug', $oldStatus); |
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 don't need to do this. The test harness will reset Configure state during its teardown method.
| } | ||
|
|
||
| // Skip authorization for DebuKit requests | ||
| $authorizationService = $this->getRequest()->getAttribute('authorization'); |
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 thought this was going to be a behavior that users could turn on. Something like DebugKit.safeTLD works.
|
Thanks. I thought my code was clean ;) |
markstory
left a comment
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.
Tests look much better now. Thank you for taking the time to update them.
| if (Configure::read('DebugKit.ignoreAuthorization')) { | ||
| $authorizationService->skipAuthorization(); | ||
| } else { | ||
| Log::info( |
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 is a nice inclusion.
Add configuration option to skip authorization for DebugKit requests. Port #734 to 4.x
Add configuration option to skip authorization for DebugKit requests. Port #734 to 4.x
Skip cakephp/authorization plugin for DebugKit requests only