Fixed the allow method to parameters not be required.

This commit is contained in:
Juan Basso 2011-08-30 21:12:57 -04:00
parent 6612cb3421
commit 840d27bbb9
2 changed files with 6 additions and 3 deletions

View file

@ -431,7 +431,7 @@ class AuthComponent extends Component {
* @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;
@ -456,7 +456,7 @@ class AuthComponent extends Component {
* @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];

View file

@ -606,7 +606,7 @@ class AuthComponentTest extends CakeTestCase {
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';
@ -621,6 +621,9 @@ class AuthComponentTest extends CakeTestCase {
$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));
}