Auth enhancement, less calls to user()

This commit is contained in:
Ceeram 2011-03-23 15:34:02 +01:00
parent 87c659d653
commit c902d4c060

View file

@ -382,7 +382,8 @@ class AuthComponent extends Object {
$controller->data[$model->alias][$this->fields['password']] = null;
return false;
} else {
if (!$this->user()) {
$user = $this->user();
if (!$user) {
if (!$this->RequestHandler->isAjax()) {
$this->Session->setFlash($this->authError, $this->flashElement, array(), 'auth');
if (!empty($controller->params['url']) && count($controller->params['url']) >= 2) {
@ -442,7 +443,7 @@ class AuthComponent extends Object {
break;
}
if ($this->isAuthorized($type)) {
if ($this->isAuthorized($type, null, $user)) {
return true;
}