Skip to content

Commit bad690c

Browse files
authored
Merge pull request #56 from cakephp/event-change
Move authorization check to Controller.startup.
2 parents d2792c4 + 351ca72 commit bad690c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Controller/Component/AuthorizationComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class AuthorizationComponent extends Component
4141
protected $_defaultConfig = [
4242
'identityAttribute' => 'identity',
4343
'serviceAttribute' => 'authorization',
44-
'authorizationEvent' => 'Controller.initialize',
44+
'authorizationEvent' => 'Controller.startup',
4545
'skipAuthorization' => [],
4646
'authorizeModel' => [],
4747
'actionMap' => []

tests/TestCase/Controller/Component/AuthorizationComponentTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,16 @@ public function testImplementedEvents()
324324
{
325325
$events = $this->Auth->implementedEvents();
326326
$this->assertEquals([
327-
'Controller.initialize' => 'authorizeAction'
327+
'Controller.startup' => 'authorizeAction'
328328
], $events);
329329
}
330330

331331
public function testImplementedCustom()
332332
{
333-
$this->Auth->setConfig('authorizationEvent', 'Controller.startup');
333+
$this->Auth->setConfig('authorizationEvent', 'Controller.initialize');
334334
$events = $this->Auth->implementedEvents();
335335
$this->assertEquals([
336-
'Controller.startup' => 'authorizeAction'
336+
'Controller.initialize' => 'authorizeAction'
337337
], $events);
338338
}
339339

0 commit comments

Comments
 (0)