Skip to content

Commit

Permalink
Fixed the allow method to parameters not be required.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Aug 31, 2011
1 parent 6612cb3 commit 840d27b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Controller/Component/AuthComponent.php
Expand Up @@ -431,7 +431,7 @@ public function constructAuthorize() {
* @return void
* @link http://book.cakephp.org/view/1257/allow
*/
public function allow($action) {
public function allow($action = null) {
$args = func_get_args();
if (empty($args) || $args == array('*')) {
$this->allowedActions = $this->_methods;
Expand All @@ -456,7 +456,7 @@ public function allow($action) {
* @see AuthComponent::allow()
* @link http://book.cakephp.org/view/1258/deny
*/
public function deny($action) {
public function deny($action = null) {
$args = func_get_args();
if (isset($args[0]) && is_array($args[0])) {
$args = $args[0];
Expand Down
Expand Up @@ -606,7 +606,7 @@ public function testAllConfigWithAuthenticate() {
public function testAllowDenyAll() {
$this->Controller->Auth->initialize($this->Controller);

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

$this->Controller->request['action'] = 'delete';
Expand All @@ -621,6 +621,9 @@ public function testAllowDenyAll() {
$this->Controller->Auth->allow('*');
$this->Controller->Auth->deny(array('add', 'camelCase'));

$this->Controller->request['action'] = 'delete';
$this->assertTrue($this->Controller->Auth->startup($this->Controller));

$this->Controller->request['action'] = 'camelCase';
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
}
Expand Down

0 comments on commit 840d27b

Please sign in to comment.