mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Make allow(null) and deny(null) consistent with no args.
No arguments and a single null should be handled the same. Fixes #2461
This commit is contained in:
parent
a8bc916104
commit
7877e7f997
2 changed files with 14 additions and 2 deletions
|
@ -432,7 +432,7 @@ class AuthComponent extends Component {
|
|||
*/
|
||||
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 @@ class AuthComponent extends Component {
|
|||
*/
|
||||
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 @@ class AuthComponentTest extends CakeTestCase {
|
|||
|
||||
$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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue