mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
updating Auth component
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5419 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a1019dfad3
commit
49817ea42d
1 changed files with 25 additions and 21 deletions
|
@ -300,34 +300,38 @@ class AuthComponent extends Object {
|
|||
}
|
||||
}
|
||||
}
|
||||
extract($this->__authType($this->authorize));
|
||||
if($type !== 'controller') {
|
||||
if(isset($controller->Acl)) {
|
||||
$this->Acl =& $controller->Acl;
|
||||
if($type == 'model') {
|
||||
if(!isset($object)) {
|
||||
if (isset($controller->{$controller->modelClass}) && is_object($controller->{$controller->modelClass})) {
|
||||
$object = $controller->modelClass;
|
||||
} elseif (!empty($controller->uses) && isset($controller->{$controller->uses[0]}) && is_object($controller->{$controller->uses[0]})) {
|
||||
$object = $controller->uses[0];
|
||||
} else {
|
||||
$object = $this->objectModel;
|
||||
|
||||
if($this->authorize) {
|
||||
extract($this->__authType($this->authorize));
|
||||
if($type !== 'controller') {
|
||||
if(isset($controller->Acl)) {
|
||||
$this->Acl =& $controller->Acl;
|
||||
if($type == 'model') {
|
||||
if(!isset($object)) {
|
||||
if (isset($controller->{$controller->modelClass}) && is_object($controller->{$controller->modelClass})) {
|
||||
$object = $controller->modelClass;
|
||||
} elseif (!empty($controller->uses) && isset($controller->{$controller->uses[0]}) && is_object($controller->{$controller->uses[0]})) {
|
||||
$object = $controller->uses[0];
|
||||
} else {
|
||||
$object = $this->objectModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->isAuthorized($type, null, $object)) {
|
||||
return true;
|
||||
if ($this->isAuthorized($type, null, $object)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
trigger_error(__('Could not find AclComponent. Please include Acl in Controller::$components.', true), E_USER_WARNING);
|
||||
}
|
||||
} else {
|
||||
trigger_error(__('Could not find AclComponent. Please include Acl in Controller::$components.', true), E_USER_WARNING);
|
||||
}
|
||||
} else {
|
||||
if (method_exists($controller, 'isAuthorized')) {
|
||||
if($controller->isAuthorized()) {
|
||||
return true;
|
||||
if (method_exists($controller, 'isAuthorized')) {
|
||||
if($controller->isAuthorized()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->Session->setFlash($this->authError);
|
||||
$controller->redirect($controller->referer(), null, true);
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue