mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-12 06:56:24 +00:00
optimization in AuthComponent class startup method
Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
parent
b1a0eb1097
commit
16eaa990df
1 changed files with 3 additions and 4 deletions
|
@ -262,10 +262,6 @@ class AuthComponent extends Object {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function startup(&$controller) {
|
function startup(&$controller) {
|
||||||
$methods = array_flip($controller->methods);
|
|
||||||
$action = strtolower($controller->params['action']);
|
|
||||||
$allowedActions = array_map('strtolower', $this->allowedActions);
|
|
||||||
|
|
||||||
$isErrorOrTests = (
|
$isErrorOrTests = (
|
||||||
strtolower($controller->name) == 'cakeerror' ||
|
strtolower($controller->name) == 'cakeerror' ||
|
||||||
(strtolower($controller->name) == 'tests' && Configure::read() > 0)
|
(strtolower($controller->name) == 'tests' && Configure::read() > 0)
|
||||||
|
@ -274,6 +270,8 @@ class AuthComponent extends Object {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$methods = array_flip($controller->methods);
|
||||||
|
$action = strtolower($controller->params['action']);
|
||||||
$isMissingAction = (
|
$isMissingAction = (
|
||||||
$controller->scaffold === false &&
|
$controller->scaffold === false &&
|
||||||
!isset($methods[$action])
|
!isset($methods[$action])
|
||||||
|
@ -296,6 +294,7 @@ class AuthComponent extends Object {
|
||||||
$url = Router::normalize($url);
|
$url = Router::normalize($url);
|
||||||
$loginAction = Router::normalize($this->loginAction);
|
$loginAction = Router::normalize($this->loginAction);
|
||||||
|
|
||||||
|
$allowedActions = array_map('strtolower', $this->allowedActions);
|
||||||
$isAllowed = (
|
$isAllowed = (
|
||||||
$this->allowedActions == array('*') ||
|
$this->allowedActions == array('*') ||
|
||||||
in_array($action, $allowedActions)
|
in_array($action, $allowedActions)
|
||||||
|
|
Loading…
Add table
Reference in a new issue