Skip to content

Commit

Permalink
Allow AuthComponent to deny all actions with single deny() or deny('*')
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielpk committed Oct 27, 2011
1 parent 1244656 commit 5246e7d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/Cake/Controller/Component/AuthComponent.php
Expand Up @@ -461,16 +461,20 @@ public function allow($action = null) {
*/
public function deny($action = null) {
$args = func_get_args();
if (isset($args[0]) && is_array($args[0])) {
$args = $args[0];
}
foreach ($args as $arg) {
$i = array_search($arg, $this->allowedActions);
if (is_int($i)) {
unset($this->allowedActions[$i]);
if(empty($args) || $args == array('*')){
$this->allowedActions = array();
}else{
if (isset($args[0]) && is_array($args[0])) {
$args = $args[0];
}
foreach ($args as $arg) {
$i = array_search($arg, $this->allowedActions);
if (is_int($i)) {
unset($this->allowedActions[$i]);
}
}
$this->allowedActions = array_values($this->allowedActions);
}
$this->allowedActions = array_values($this->allowedActions);
}

/**
Expand Down

0 comments on commit 5246e7d

Please sign in to comment.