From 09579198a94422ea0195f662f52c409e317e2e21 Mon Sep 17 00:00:00 2001 From: Daniel Pakuschewski Date: Sat, 29 Oct 2011 13:54:35 -0200 Subject: [PATCH] Droped support to deny('*'). --- lib/Cake/Controller/Component/AuthComponent.php | 5 +++-- .../Case/Controller/Component/AuthComponentTest.php | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index a1dae987f..83c6dab1f 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -452,7 +452,8 @@ class AuthComponent extends Component { * You can use deny with either an array, or var args. * * `$this->Auth->deny(array('edit', 'add'));` or - * `$this->Auth->deny('edit', 'add');` + * `$this->Auth->deny('edit', 'add');` or + * `$this->Auth->deny();` to remove all items from the allowed list * * @param mixed $action,... Controller action name or array of actions * @return void @@ -461,7 +462,7 @@ class AuthComponent extends Component { */ public function deny($action = null) { $args = func_get_args(); - if(empty($args) || $args == array('*')){ + if(empty($args)){ $this->allowedActions = array(); }else{ if (isset($args[0]) && is_array($args[0])) { diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index fa718f11c..9bbc0002f 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -638,7 +638,7 @@ class AuthComponentTest extends CakeTestCase { $this->assertFalse($this->Controller->Auth->startup($this->Controller)); $this->Controller->Auth->allow('*'); - $this->Controller->Auth->deny('*'); + $this->Controller->Auth->deny(); $this->Controller->request['action'] = 'camelCase'; $this->assertFalse($this->Controller->Auth->startup($this->Controller)); @@ -655,6 +655,15 @@ class AuthComponentTest extends CakeTestCase { $this->Controller->request['action'] = 'login'; $this->assertFalse($this->Controller->Auth->startup($this->Controller)); + $this->Controller->Auth->allow(); + $this->Controller->Auth->deny('*'); + + $this->Controller->request['action'] = 'camelCase'; + $this->assertTrue($this->Controller->Auth->startup($this->Controller)); + + $this->Controller->request['action'] = 'login'; + $this->assertTrue($this->Controller->Auth->startup($this->Controller)); + } /**