Skip to content

Commit

Permalink
Droped support to deny('*').
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Pakuschewski committed Oct 29, 2011
1 parent 8738ef3 commit 0957919
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/Cake/Controller/Component/AuthComponent.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ public function allow($action = null) {
* You can use deny with either an array, or var args. * You can use deny with either an array, or var args.
* *
* `$this->Auth->deny(array('edit', 'add'));` or * `$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 * @param mixed $action,... Controller action name or array of actions
* @return void * @return void
Expand All @@ -461,7 +462,7 @@ public function allow($action = null) {
*/ */
public function deny($action = null) { public function deny($action = null) {
$args = func_get_args(); $args = func_get_args();
if(empty($args) || $args == array('*')){ if(empty($args)){
$this->allowedActions = array(); $this->allowedActions = array();
}else{ }else{
if (isset($args[0]) && is_array($args[0])) { if (isset($args[0]) && is_array($args[0])) {
Expand Down
11 changes: 10 additions & 1 deletion lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ public function testAllowDenyAll() {
$this->assertFalse($this->Controller->Auth->startup($this->Controller)); $this->assertFalse($this->Controller->Auth->startup($this->Controller));


$this->Controller->Auth->allow('*'); $this->Controller->Auth->allow('*');
$this->Controller->Auth->deny('*'); $this->Controller->Auth->deny();


$this->Controller->request['action'] = 'camelCase'; $this->Controller->request['action'] = 'camelCase';
$this->assertFalse($this->Controller->Auth->startup($this->Controller)); $this->assertFalse($this->Controller->Auth->startup($this->Controller));
Expand All @@ -655,6 +655,15 @@ public function testAllowDenyAll() {
$this->Controller->request['action'] = 'login'; $this->Controller->request['action'] = 'login';
$this->assertFalse($this->Controller->Auth->startup($this->Controller)); $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));

} }


/** /**
Expand Down

0 comments on commit 0957919

Please sign in to comment.