Skip to content
Permalink
Browse files

Make allow(null) and deny(null) consistent with no args.

No arguments and a single null should be handled the same.

Fixes #2461
  • Loading branch information...
markstory committed Jan 11, 2012
1 parent a8bc916 commit 7877e7f997cf4592a5f3eb743069db605cb6561a
@@ -432,7 +432,7 @@ public function constructAuthorize() {
*/
public function allow($action = null) {
$args = func_get_args();
if (empty($args)) {
if (empty($args) || $action === null) {
$this->allowedActions = $this->_methods;
} else {
if (isset($args[0]) && is_array($args[0])) {
@@ -458,7 +458,7 @@ public function allow($action = null) {
*/
public function deny($action = null) {
$args = func_get_args();
if (empty($args)) {
if (empty($args) || $action === null) {
$this->allowedActions = array();
} else {
if (isset($args[0]) && is_array($args[0])) {
@@ -654,6 +654,18 @@ public function testAllowDenyAll() {
$this->Controller->request['action'] = 'login';
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
$this->Controller->Auth->deny();
$this->Controller->Auth->allow(null);
$this->Controller->request['action'] = 'camelCase';
$this->assertTrue($this->Controller->Auth->startup($this->Controller));
$this->Controller->Auth->allow();
$this->Controller->Auth->deny(null);
$this->Controller->request['action'] = 'camelCase';
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
}
/**

0 comments on commit 7877e7f

Please sign in to comment.
You can’t perform that action at this time.