Skip to content

Commit

Permalink
Merge pull request #56 from cakephp/event-change
Browse files Browse the repository at this point in the history
Move authorization check to Controller.startup.
  • Loading branch information
markstory committed Aug 3, 2018
2 parents d2792c4 + 351ca72 commit bad690c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Component/AuthorizationComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AuthorizationComponent extends Component
protected $_defaultConfig = [
'identityAttribute' => 'identity',
'serviceAttribute' => 'authorization',
'authorizationEvent' => 'Controller.initialize',
'authorizationEvent' => 'Controller.startup',
'skipAuthorization' => [],
'authorizeModel' => [],
'actionMap' => []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,16 @@ public function testImplementedEvents()
{
$events = $this->Auth->implementedEvents();
$this->assertEquals([
'Controller.initialize' => 'authorizeAction'
'Controller.startup' => 'authorizeAction'
], $events);
}

public function testImplementedCustom()
{
$this->Auth->setConfig('authorizationEvent', 'Controller.startup');
$this->Auth->setConfig('authorizationEvent', 'Controller.initialize');
$events = $this->Auth->implementedEvents();
$this->assertEquals([
'Controller.startup' => 'authorizeAction'
'Controller.initialize' => 'authorizeAction'
], $events);
}

Expand Down

0 comments on commit bad690c

Please sign in to comment.