Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Droped support to deny('*').

  • Loading branch information...
commit 09579198a94422ea0195f662f52c409e317e2e21 1 parent 8738ef3
@Danielpk Danielpk authored
View
5 lib/Cake/Controller/Component/AuthComponent.php
@@ -452,7 +452,8 @@ public function allow($action = null) {
* 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 @@ public function allow($action = null) {
*/
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])) {
View
11 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
@@ -638,7 +638,7 @@ public function testAllowDenyAll() {
$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 @@ public function testAllowDenyAll() {
$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));
+
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.