mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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:
parent
1d46e068d3
commit
c740e02896
3 changed files with 35 additions and 32 deletions
|
@ -31,7 +31,7 @@ APP=`pwd`
|
||||||
|
|
||||||
echo "Hello $USER,"
|
echo "Hello $USER,"
|
||||||
|
|
||||||
exec php -q ${LIB}cake.php "$@" -working "${APP}"
|
exec php -q ${LIB}cake.php -working "${APP}" "$@"
|
||||||
|
|
||||||
echo " ";
|
echo " ";
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,6 @@
|
||||||
SET app=%0
|
SET app=%0
|
||||||
SET lib=%~dp0
|
SET lib=%~dp0
|
||||||
|
|
||||||
php -q "%lib%cake.php" %* -working "%CD%"
|
php -q "%lib%cake.php" -working "%CD%" %*
|
||||||
|
|
||||||
echo.
|
echo.
|
|
@ -319,12 +319,10 @@ class AuthComponent extends Object {
|
||||||
|
|
||||||
if ($this->authorize) {
|
if ($this->authorize) {
|
||||||
extract($this->__authType());
|
extract($this->__authType());
|
||||||
if ($type == 'controller') {
|
|
||||||
if ($controller->isAuthorized()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
case 'controller':
|
||||||
|
$this->object =& $controller;
|
||||||
|
break;
|
||||||
case 'crud':
|
case 'crud':
|
||||||
case 'actions':
|
case 'actions':
|
||||||
if (isset($controller->Acl)) {
|
if (isset($controller->Acl)) {
|
||||||
|
@ -344,12 +342,14 @@ class AuthComponent extends Object {
|
||||||
$type = array('model' => $object);
|
$type = array('model' => $object);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isAuthorized($type)) {
|
if ($this->isAuthorized($type)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$this->Session->setFlash($this->authError, 'default', array(), 'auth');
|
$this->Session->setFlash($this->authError, 'default', array(), 'auth');
|
||||||
$controller->redirect($controller->referer(), null, true);
|
$controller->redirect($controller->referer(), null, true);
|
||||||
return false;
|
return false;
|
||||||
|
@ -386,7 +386,7 @@ class AuthComponent extends Object {
|
||||||
* used is based on the value of AuthComponent::$authorize or the passed $type param.
|
* used is based on the value of AuthComponent::$authorize or the passed $type param.
|
||||||
*
|
*
|
||||||
* Types:
|
* 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()
|
* 'actions' will validate Controller::action against an AclComponent::check()
|
||||||
* 'crud' will validate mapActions 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)
|
* array('model'=> 'name'); will validate mapActions against model $name::isAuthorize(user, controller, mapAction)
|
||||||
|
@ -413,6 +413,9 @@ class AuthComponent extends Object {
|
||||||
|
|
||||||
$valid = false;
|
$valid = false;
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
case 'controller':
|
||||||
|
$valid = $object->isAuthorized();
|
||||||
|
break;
|
||||||
case 'actions':
|
case 'actions':
|
||||||
$valid = $this->Acl->check($user, $this->action());
|
$valid = $this->Acl->check($user, $this->action());
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue