Skip to content

Commit a6478ea

Browse files
authored
Merge pull request #1055 from cakephp/fix-debug-mode-default
Allow debug mode by default.
2 parents 3702de8 + 2c50292 commit a6478ea

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ working correctly. Some common problems are:
4545
itself to protect a potentially non-development environment.
4646
3. If you are using the [Authorization Plugin](https://github.com/cakephp/authorization)
4747
you need to set `DebugKit.ignoreAuthorization` to `true` in your config.
48+
Not needed anymore for DebugKit 5.3.0+.
4849

4950
## Reporting Issues
5051

docs/en/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ Configuration
6262
// Ignore image paths
6363
Configure::write('DebugKit.ignorePathsPattern', '/\.(jpg|png|gif)$/');
6464

65-
* ``DebugKit.ignoreAuthorization`` - Set to true to ignore Cake Authorization plugin for DebugKit requests. Disabled by default.
65+
* ``DebugKit.ignoreAuthorization`` - Set to true to ignore Cake Authorization plugin for DebugKit requests.
66+
Not needed anymore for DebugKit 5.3.0+.
6667

6768
* ``DebugKit.maxDepth`` - Defines how many levels of nested data should be shown in general for debug output. Default is 5.
6869
WARNING: Increasing the max depth level can lead to an out of memory error.::

src/Controller/DebugKitController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function beforeFilter(EventInterface $event): void
4343
// ignore it, only if `DebugKit.ignoreAuthorization` is set to true
4444
$authorizationService = $this->getRequest()->getAttribute('authorization');
4545
if ($authorizationService instanceof AuthorizationService) {
46-
if (Configure::read('DebugKit.ignoreAuthorization')) {
46+
if (Configure::read('DebugKit.ignoreAuthorization') !== false) {
4747
$authorizationService->skipAuthorization();
4848
} else {
4949
Log::info(

tests/TestCase/Controller/DebugKitControllerTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,33 +67,33 @@ private function _buildController()
6767
}
6868

6969
/**
70-
* tests authorization is enabled but not ignored
70+
* tests authorization is checked to avoid
71+
* AuthorizationRequiredException throwned
7172
*
7273
* @return void
7374
*/
74-
public function testDontIgnoreAuthorization()
75+
public function testIgnoreAuthorization()
7576
{
7677
$controller = $this->_buildController();
7778
$event = new Event('testing');
7879
$controller->beforeFilter($event);
7980

80-
$this->assertFalse($controller->getRequest()->getAttribute('authorization')->authorizationChecked());
81+
$this->assertTrue($controller->getRequest()->getAttribute('authorization')->authorizationChecked());
8182
}
8283

8384
/**
84-
* tests authorization is checked to avoid
85-
* AuthorizationRequiredException throwned
85+
* tests authorization is enabled but not ignored
8686
*
8787
* @return void
8888
*/
89-
public function testIgnoreAuthorization()
89+
public function testDontIgnoreAuthorization()
9090
{
91-
Configure::write('DebugKit.ignoreAuthorization', true);
91+
Configure::write('DebugKit.ignoreAuthorization', false);
9292

9393
$controller = $this->_buildController();
9494
$event = new Event('testing');
9595
$controller->beforeFilter($event);
9696

97-
$this->assertTrue($controller->getRequest()->getAttribute('authorization')->authorizationChecked());
97+
$this->assertFalse($controller->getRequest()->getAttribute('authorization')->authorizationChecked());
9898
}
9999
}

0 commit comments

Comments
 (0)