mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixed the allow method to parameters not be required.
This commit is contained in:
parent
6612cb3421
commit
840d27bbb9
2 changed files with 6 additions and 3 deletions
|
@ -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];
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue