Skip to content

Commit c836b22

Browse files
authored
Merge pull request #1056 from cakephp/cleanup
Cleanup
2 parents a6478ea + 1b2b123 commit c836b22

File tree

6 files changed

+80
-43
lines changed

6 files changed

+80
-43
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ working correctly. Some common problems are:
4343
2. Your hostname needs to be added to the `DebugKit.safeTld`. If your local
4444
domain isn't a known development environment name, DebugKit will disable
4545
itself to protect a potentially non-development environment.
46-
3. If you are using the [Authorization Plugin](https://github.com/cakephp/authorization)
47-
you need to set `DebugKit.ignoreAuthorization` to `true` in your config.
48-
Not needed anymore for DebugKit 5.3.0+.
4946

5047
## Reporting Issues
5148

config/app.example.php

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
/**
3+
* DebugKit configuration options.
4+
*
5+
* Copy this file to your application's config directory and include it
6+
* in your bootstrap or application configuration.
7+
*
8+
* All options shown below use their default values.
9+
*/
10+
return [
11+
'DebugKit' => [
12+
/**
13+
* Enable or disable panels for DebugKit. You can disable any of the
14+
* standard panels by setting them to false.
15+
*
16+
* Example: ['DebugKit.Packages' => false]
17+
*/
18+
// 'panels' => [],
19+
20+
/**
21+
* Set to true to enable logging of schema reflection queries.
22+
* Disabled by default.
23+
*/
24+
// 'includeSchemaReflection' => false,
25+
26+
/**
27+
* Set an array of whitelisted TLDs for local development.
28+
* This can be used to make sure DebugKit displays on hosts
29+
* it otherwise determines unsafe.
30+
*
31+
* Example: ['test', 'local', 'example']
32+
*/
33+
// 'safeTld' => [],
34+
35+
/**
36+
* Force DebugKit to display. Careful with this, it is usually
37+
* safer to simply whitelist your local TLDs.
38+
*
39+
* Can also be set to a callable that returns a boolean.
40+
* Example: function() { return $_SERVER['REMOTE_ADDR'] === '192.168.2.182'; }
41+
*/
42+
// 'forceEnable' => false,
43+
44+
/**
45+
* Regex pattern (including delimiter) to ignore paths.
46+
* DebugKit won't save data for request URLs that match this regex.
47+
*
48+
* Example: '/\.(jpg|png|gif)$/'
49+
*/
50+
// 'ignorePathsPattern' => null,
51+
52+
/**
53+
* Defines how many levels of nested data should be shown in general
54+
* for debug output.
55+
*
56+
* WARNING: Increasing the max depth level can lead to an out of memory error.
57+
*/
58+
// 'maxDepth' => 5,
59+
60+
/**
61+
* Defines how many levels of nested data should be shown in the
62+
* variables tab.
63+
*
64+
* WARNING: Increasing the max depth level can lead to an out of memory error.
65+
*/
66+
// 'variablesPanelMaxDepth' => 5,
67+
68+
/**
69+
* Number of requests to keep in history panel.
70+
*/
71+
// 'requestCount' => 20,
72+
],
73+
];

docs/en/index.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ 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.
66-
Not needed anymore for DebugKit 5.3.0+.
67-
6865
* ``DebugKit.maxDepth`` - Defines how many levels of nested data should be shown in general for debug output. Default is 5.
6966
WARNING: Increasing the max depth level can lead to an out of memory error.::
7067

docs/fr/index.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ Ensuite, vous devez activer le plugin en exécutant la ligne suivante::
3030

3131
bin/cake plugin load DebugKit
3232

33-
Configuration
34-
=============
35-
36-
* ``DebugKit.ignoreAuthorization`` - Définie à true pour ignorer le plugin Cake Authorization uniquement pour les requêtes DebugKit. Par défaut à false.
37-
3833
Stockage de DebugKit
3934
====================
4035

src/Controller/DebugKitController.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Cake\Core\Configure;
2020
use Cake\Event\EventInterface;
2121
use Cake\Http\Exception\NotFoundException;
22-
use Cake\Log\Log;
2322

2423
/**
2524
* DebugKit Controller.
@@ -39,19 +38,9 @@ public function beforeFilter(EventInterface $event): void
3938
throw new NotFoundException('Not available without debug mode on.');
4039
}
4140

42-
// If CakePHP Authorization\Authorization plugin is enabled,
43-
// ignore it, only if `DebugKit.ignoreAuthorization` is set to true
4441
$authorizationService = $this->getRequest()->getAttribute('authorization');
4542
if ($authorizationService instanceof AuthorizationService) {
46-
if (Configure::read('DebugKit.ignoreAuthorization') !== false) {
47-
$authorizationService->skipAuthorization();
48-
} else {
49-
Log::info(
50-
'Cake Authorization plugin is enabled. If you would like ' .
51-
'to force DebugKit to ignore it, set `DebugKit.ignoreAuthorization` ' .
52-
' Configure option to true.',
53-
);
54-
}
43+
$authorizationService->skipAuthorization();
5544
}
5645
}
5746
}

tests/TestCase/Controller/DebugKitControllerTest.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
use DebugKit\TestApp\Application;
2727

2828
/**
29-
* Composer controller test.
29+
* DebugKit controller test.
30+
*
31+
* @uses \DebugKit\Controller\DebugKitController
3032
*/
3133
class DebugKitControllerTest extends TestCase
3234
{
@@ -67,33 +69,17 @@ private function _buildController()
6769
}
6870

6971
/**
70-
* tests authorization is checked to avoid
71-
* AuthorizationRequiredException throwned
72+
* Tests authorization is skipped to avoid
73+
* AuthorizationRequiredException thrown.
7274
*
7375
* @return void
7476
*/
75-
public function testIgnoreAuthorization()
77+
public function testAuthorizationSkipped(): void
7678
{
7779
$controller = $this->_buildController();
7880
$event = new Event('testing');
7981
$controller->beforeFilter($event);
8082

8183
$this->assertTrue($controller->getRequest()->getAttribute('authorization')->authorizationChecked());
8284
}
83-
84-
/**
85-
* tests authorization is enabled but not ignored
86-
*
87-
* @return void
88-
*/
89-
public function testDontIgnoreAuthorization()
90-
{
91-
Configure::write('DebugKit.ignoreAuthorization', false);
92-
93-
$controller = $this->_buildController();
94-
$event = new Event('testing');
95-
$controller->beforeFilter($event);
96-
97-
$this->assertFalse($controller->getRequest()->getAttribute('authorization')->authorizationChecked());
98-
}
9985
}

0 commit comments

Comments
 (0)