updating Auth and console script params

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5724 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-10-06 01:00:55 +00:00
parent 1d46e068d3
commit c740e02896
3 changed files with 35 additions and 32 deletions

View file

@ -31,7 +31,7 @@ APP=`pwd`
echo "Hello $USER,"
exec php -q ${LIB}cake.php "$@" -working "${APP}"
exec php -q ${LIB}cake.php -working "${APP}" "$@"
echo " ";

View file

@ -32,6 +32,6 @@
SET app=%0
SET lib=%~dp0
php -q "%lib%cake.php" %* -working "%CD%"
php -q "%lib%cake.php" -working "%CD%" %*
echo.

View file

@ -319,37 +319,37 @@ class AuthComponent extends Object {
if ($this->authorize) {
extract($this->__authType());
if ($type == 'controller') {
if ($controller->isAuthorized()) {
return true;
}
} else {
switch ($type) {
case 'crud':
case 'actions':
if (isset($controller->Acl)) {
$this->Acl =& $controller->Acl;
} else {
trigger_error(__('Could not find AclComponent. Please include Acl in Controller::$components.', true), E_USER_WARNING);
switch ($type) {
case 'controller':
$this->object =& $controller;
break;
case 'crud':
case 'actions':
if (isset($controller->Acl)) {
$this->Acl =& $controller->Acl;
} else {
trigger_error(__('Could not find AclComponent. Please include Acl in Controller::$components.', true), E_USER_WARNING);
}
break;
case '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];
}
break;
case '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];
}
}
$type = array('model' => $object);
break;
default:
break;
}
if ($this->isAuthorized($type)) {
}
$type = array('model' => $object);
break;
default:
return true;
}
break;
}
if ($this->isAuthorized($type)) {
return true;
}
$this->Session->setFlash($this->authError, 'default', array(), 'auth');
$controller->redirect($controller->referer(), null, true);
return false;
@ -386,7 +386,7 @@ class AuthComponent extends Object {
* used is based on the value of AuthComponent::$authorize or the passed $type param.
*
* Types:
* 'controller' will validate against Controller::isAuthorized()
* 'controller' will validate against Controller::isAuthorized() if controller instance is passed in $object
* 'actions' will validate Controller::action against an AclComponent::check()
* 'crud' will validate mapActions against an AclComponent::check()
* array('model'=> 'name'); will validate mapActions against model $name::isAuthorize(user, controller, mapAction)
@ -413,6 +413,9 @@ class AuthComponent extends Object {
$valid = false;
switch ($type) {
case 'controller':
$valid = $object->isAuthorized();
break;
case 'actions':
$valid = $this->Acl->check($user, $this->action());
break;
@ -822,4 +825,4 @@ class AuthComponent extends Object {
return $url;
}
}
?>
?>