mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-08-06 08:03:39 +02:00
Upgrade CakePHP from 2.2.5 to 2.9.5
This commit is contained in:
parent
5a580df460
commit
235a541597
793 changed files with 60746 additions and 23753 deletions
|
@ -2,18 +2,17 @@
|
|||
/**
|
||||
* Acl Shell provides Acl access in the CLI environment
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @since CakePHP(tm) v 1.2.0.5012
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('AppShell', 'Console/Command');
|
||||
|
@ -24,8 +23,8 @@ App::uses('DbAcl', 'Model');
|
|||
App::uses('Hash', 'Utility');
|
||||
|
||||
/**
|
||||
* Shell for ACL management. This console is known to have issues with zend.ze1_compatibility_mode
|
||||
* being enabled. Be sure to turn it off when using this shell.
|
||||
* Shell for ACL management. This console is known to have issues with zend.ze1_compatibility_mode
|
||||
* being enabled. Be sure to turn it off when using this shell.
|
||||
*
|
||||
* @package Cake.Console.Command
|
||||
*/
|
||||
|
@ -75,22 +74,22 @@ class AclShell extends AppShell {
|
|||
App::uses($class, $plugin . 'Controller/Component/Acl');
|
||||
if (!in_array($class, array('DbAcl', 'DB_ACL')) && !is_subclass_of($class, 'DbAcl')) {
|
||||
$out = "--------------------------------------------------\n";
|
||||
$out .= __d('cake_console', 'Error: Your current Cake configuration is set to an ACL implementation other than DB.') . "\n";
|
||||
$out .= __d('cake_console', 'Error: Your current CakePHP configuration is set to an ACL implementation other than DB.') . "\n";
|
||||
$out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
|
||||
$out .= "--------------------------------------------------\n";
|
||||
$out .= __d('cake_console', 'Current ACL Classname: %s', $class) . "\n";
|
||||
$out .= "--------------------------------------------------\n";
|
||||
$this->err($out);
|
||||
$this->_stop();
|
||||
return $this->_stop();
|
||||
}
|
||||
|
||||
if ($this->command) {
|
||||
if (!config('database')) {
|
||||
$this->out(__d('cake_console', 'Your database configuration was not found. Take a moment to create one.'), true);
|
||||
$this->out(__d('cake_console', 'Your database configuration was not found. Take a moment to create one.'));
|
||||
$this->args = null;
|
||||
return $this->DbConfig->execute();
|
||||
}
|
||||
require_once (APP . 'Config' . DS . 'database.php');
|
||||
require_once APP . 'Config' . DS . 'database.php';
|
||||
|
||||
if (!in_array($this->command, array('initdb'))) {
|
||||
$collection = new ComponentCollection();
|
||||
|
@ -121,14 +120,14 @@ class AclShell extends AppShell {
|
|||
$class = ucfirst($this->args[0]);
|
||||
$parent = $this->parseIdentifier($this->args[1]);
|
||||
|
||||
if (!empty($parent) && $parent != '/' && $parent != 'root') {
|
||||
if (!empty($parent) && $parent !== '/' && $parent !== 'root') {
|
||||
$parent = $this->_getNodeId($class, $parent);
|
||||
} else {
|
||||
$parent = null;
|
||||
}
|
||||
|
||||
$data = $this->parseIdentifier($this->args[2]);
|
||||
if (is_string($data) && $data != '/') {
|
||||
if (is_string($data) && $data !== '/') {
|
||||
$data = array('alias' => $data);
|
||||
} elseif (is_string($data)) {
|
||||
$this->error(__d('cake_console', '/ can not be used as an alias!') . __d('cake_console', " / is the root, please supply a sub alias"));
|
||||
|
@ -144,7 +143,8 @@ class AclShell extends AppShell {
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete an ARO/ACO node.
|
||||
* Delete an ARO/ACO node. Note there may be (as a result of poor configuration)
|
||||
* multiple records with the same logical identifier. All are deleted.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -152,12 +152,18 @@ class AclShell extends AppShell {
|
|||
extract($this->_dataVars());
|
||||
|
||||
$identifier = $this->parseIdentifier($this->args[1]);
|
||||
$nodeId = $this->_getNodeId($class, $identifier);
|
||||
|
||||
if (!$this->Acl->{$class}->delete($nodeId)) {
|
||||
$this->error(__d('cake_console', 'Node Not Deleted') . __d('cake_console', 'There was an error deleting the %s. Check that the node exists.', $class) . "\n");
|
||||
if (is_string($identifier)) {
|
||||
$identifier = array('alias' => $identifier);
|
||||
}
|
||||
|
||||
if ($this->Acl->{$class}->find('all', array('conditions' => $identifier))) {
|
||||
if (!$this->Acl->{$class}->deleteAll($identifier)) {
|
||||
$this->error(__d('cake_console', 'Node Not Deleted. ') . __d('cake_console', 'There was an error deleting the %s.', $class) . "\n");
|
||||
}
|
||||
$this->out(__d('cake_console', '<success>%s deleted.</success>', $class), 2);
|
||||
} else {
|
||||
$this->error(__d('cake_console', 'Node Not Deleted. ') . __d('cake_console', 'There was an error deleting the %s. Node does not exist.', $class) . "\n");
|
||||
}
|
||||
$this->out(__d('cake_console', '<success>%s deleted.</success>', $class), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,9 +184,9 @@ class AclShell extends AppShell {
|
|||
);
|
||||
$this->Acl->{$class}->create();
|
||||
if (!$this->Acl->{$class}->save($data)) {
|
||||
$this->out(__d('cake_console', 'Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.'), true);
|
||||
$this->out(__d('cake_console', 'Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.'));
|
||||
} else {
|
||||
$this->out(__d('cake_console', 'Node parent set to %s', $this->args[2]) . "\n", true);
|
||||
$this->out(__d('cake_console', 'Node parent set to %s', $this->args[2]) . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,7 +220,7 @@ class AclShell extends AppShell {
|
|||
*
|
||||
* @param string $class Class name that is being used.
|
||||
* @param array $node Array of node information.
|
||||
* @param integer $indent indent level.
|
||||
* @param int $indent indent level.
|
||||
* @return void
|
||||
*/
|
||||
protected function _outputNode($class, $node, $indent) {
|
||||
|
@ -236,9 +242,9 @@ class AclShell extends AppShell {
|
|||
extract($this->_getParams());
|
||||
|
||||
if ($this->Acl->check($aro, $aco, $action)) {
|
||||
$this->out(__d('cake_console', '%s is <success>allowed</success>.', $aroName), true);
|
||||
$this->out(__d('cake_console', '%s is <success>allowed</success>.', $aroName));
|
||||
} else {
|
||||
$this->out(__d('cake_console', '%s is <error>not allowed</error>.', $aroName), true);
|
||||
$this->out(__d('cake_console', '%s is <error>not allowed</error>.', $aroName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,9 +257,9 @@ class AclShell extends AppShell {
|
|||
extract($this->_getParams());
|
||||
|
||||
if ($this->Acl->allow($aro, $aco, $action)) {
|
||||
$this->out(__d('cake_console', 'Permission <success>granted</success>.'), true);
|
||||
$this->out(__d('cake_console', 'Permission <success>granted</success>.'));
|
||||
} else {
|
||||
$this->out(__d('cake_console', 'Permission was <error>not granted</error>.'), true);
|
||||
$this->out(__d('cake_console', 'Permission was <error>not granted</error>.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,9 +272,9 @@ class AclShell extends AppShell {
|
|||
extract($this->_getParams());
|
||||
|
||||
if ($this->Acl->deny($aro, $aco, $action)) {
|
||||
$this->out(__d('cake_console', 'Permission denied.'), true);
|
||||
$this->out(__d('cake_console', 'Permission denied.'));
|
||||
} else {
|
||||
$this->out(__d('cake_console', 'Permission was not denied.'), true);
|
||||
$this->out(__d('cake_console', 'Permission was not denied.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,9 +287,9 @@ class AclShell extends AppShell {
|
|||
extract($this->_getParams());
|
||||
|
||||
if ($this->Acl->inherit($aro, $aco, $action)) {
|
||||
$this->out(__d('cake_console', 'Permission inherited.'), true);
|
||||
$this->out(__d('cake_console', 'Permission inherited.'));
|
||||
} else {
|
||||
$this->out(__d('cake_console', 'Permission was not inherited.'), true);
|
||||
$this->out(__d('cake_console', 'Permission was not inherited.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,7 +330,7 @@ class AclShell extends AppShell {
|
|||
$this->hr();
|
||||
|
||||
$stack = array();
|
||||
$last = null;
|
||||
$last = null;
|
||||
|
||||
foreach ($nodes as $n) {
|
||||
$stack[] = $n;
|
||||
|
@ -357,9 +363,9 @@ class AclShell extends AppShell {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the option parser.
|
||||
* Gets the option parser instance and configures it.
|
||||
*
|
||||
* @return void
|
||||
* @return ConsoleOptionParser
|
||||
*/
|
||||
public function getOptionParser() {
|
||||
$parser = parent::getOptionParser();
|
||||
|
@ -372,148 +378,148 @@ class AclShell extends AppShell {
|
|||
|
||||
$parser->description(
|
||||
__d('cake_console', 'A console tool for managing the DbAcl')
|
||||
)->addSubcommand('create', array(
|
||||
'help' => __d('cake_console', 'Create a new ACL node'),
|
||||
'parser' => array(
|
||||
'description' => __d('cake_console', 'Creates a new ACL object <node> under the parent'),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
'parent' => array(
|
||||
'help' => __d('cake_console', 'The node selector for the parent.'),
|
||||
'required' => true
|
||||
),
|
||||
'alias' => array(
|
||||
'help' => __d('cake_console', 'The alias to use for the newly created node.'),
|
||||
'required' => true
|
||||
)
|
||||
)
|
||||
)
|
||||
))->addSubcommand('delete', array(
|
||||
'help' => __d('cake_console', 'Deletes the ACL object with the given <node> reference'),
|
||||
'parser' => array(
|
||||
'description' => __d('cake_console', 'Delete an ACL node.'),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
'node' => array(
|
||||
'help' => __d('cake_console', 'The node identifier to delete.'),
|
||||
'required' => true,
|
||||
)
|
||||
)
|
||||
)
|
||||
))->addSubcommand('setparent', array(
|
||||
'help' => __d('cake_console', 'Moves the ACL node under a new parent.'),
|
||||
'parser' => array(
|
||||
'description' => __d('cake_console', 'Moves the ACL object specified by <node> beneath <parent>'),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
'node' => array(
|
||||
'help' => __d('cake_console', 'The node to move'),
|
||||
'required' => true,
|
||||
),
|
||||
'parent' => array(
|
||||
'help' => __d('cake_console', 'The new parent for <node>.'),
|
||||
'required' => true
|
||||
)
|
||||
)
|
||||
)
|
||||
))->addSubcommand('getpath', array(
|
||||
'help' => __d('cake_console', 'Print out the path to an ACL node.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "Returns the path to the ACL object specified by <node>."),
|
||||
__d('cake_console', "This command is useful in determining the inheritance of permissions for a certain object in the tree.")
|
||||
)->addSubcommand('create', array(
|
||||
'help' => __d('cake_console', 'Create a new ACL node'),
|
||||
'parser' => array(
|
||||
'description' => __d('cake_console', 'Creates a new ACL object <node> under the parent'),
|
||||
'epilog' => __d('cake_console', 'You can use `root` as the parent when creating nodes to create top level nodes.'),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
'parent' => array(
|
||||
'help' => __d('cake_console', 'The node selector for the parent.'),
|
||||
'required' => true
|
||||
),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
'node' => array(
|
||||
'help' => __d('cake_console', 'The node to get the path of'),
|
||||
'required' => true,
|
||||
)
|
||||
'alias' => array(
|
||||
'help' => __d('cake_console', 'The alias to use for the newly created node.'),
|
||||
'required' => true
|
||||
)
|
||||
)
|
||||
))->addSubcommand('check', array(
|
||||
'help' => __d('cake_console', 'Check the permissions between an ACO and ARO.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', 'Use this command to check ACL permissions.')
|
||||
)
|
||||
))->addSubcommand('delete', array(
|
||||
'help' => __d('cake_console', 'Deletes the ACL object with the given <node> reference'),
|
||||
'parser' => array(
|
||||
'description' => __d('cake_console', 'Delete an ACL node.'),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
'node' => array(
|
||||
'help' => __d('cake_console', 'The node identifier to delete.'),
|
||||
'required' => true,
|
||||
)
|
||||
)
|
||||
)
|
||||
))->addSubcommand('setparent', array(
|
||||
'help' => __d('cake_console', 'Moves the ACL node under a new parent.'),
|
||||
'parser' => array(
|
||||
'description' => __d('cake_console', 'Moves the ACL object specified by <node> beneath <parent>'),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
'node' => array(
|
||||
'help' => __d('cake_console', 'The node to move'),
|
||||
'required' => true,
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to check.'), 'required' => true),
|
||||
'aco' => array('help' => __d('cake_console', 'ACO to check.'), 'required' => true),
|
||||
'action' => array('help' => __d('cake_console', 'Action to check'), 'default' => 'all')
|
||||
'parent' => array(
|
||||
'help' => __d('cake_console', 'The new parent for <node>.'),
|
||||
'required' => true
|
||||
)
|
||||
)
|
||||
))->addSubcommand('grant', array(
|
||||
'help' => __d('cake_console', 'Grant an ARO permissions to an ACO.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).')
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to grant permission to.'), 'required' => true),
|
||||
'aco' => array('help' => __d('cake_console', 'ACO to grant access to.'), 'required' => true),
|
||||
'action' => array('help' => __d('cake_console', 'Action to grant'), 'default' => 'all')
|
||||
)
|
||||
))->addSubcommand('getpath', array(
|
||||
'help' => __d('cake_console', 'Print out the path to an ACL node.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "Returns the path to the ACL object specified by <node>."),
|
||||
__d('cake_console', "This command is useful in determining the inheritance of permissions for a certain object in the tree.")
|
||||
),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
'node' => array(
|
||||
'help' => __d('cake_console', 'The node to get the path of'),
|
||||
'required' => true,
|
||||
)
|
||||
)
|
||||
))->addSubcommand('deny', array(
|
||||
'help' => __d('cake_console', 'Deny an ARO permissions to an ACO.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', 'Use this command to deny ACL permissions. Once executed, the ARO specified (and its children, if any) will have DENY access to the specified ACO action (and the ACO\'s children, if any).')
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to deny.'), 'required' => true),
|
||||
'aco' => array('help' => __d('cake_console', 'ACO to deny.'), 'required' => true),
|
||||
'action' => array('help' => __d('cake_console', 'Action to deny'), 'default' => 'all')
|
||||
)
|
||||
)
|
||||
))->addSubcommand('check', array(
|
||||
'help' => __d('cake_console', 'Check the permissions between an ACO and ARO.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', 'Use this command to check ACL permissions.')
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to check.'), 'required' => true),
|
||||
'aco' => array('help' => __d('cake_console', 'ACO to check.'), 'required' => true),
|
||||
'action' => array('help' => __d('cake_console', 'Action to check'), 'default' => 'all')
|
||||
)
|
||||
))->addSubcommand('inherit', array(
|
||||
'help' => __d('cake_console', 'Inherit an ARO\'s parent permissions.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "Use this command to force a child ARO object to inherit its permissions settings from its parent.")
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to have permissions inherit.'), 'required' => true),
|
||||
'aco' => array('help' => __d('cake_console', 'ACO to inherit permissions on.'), 'required' => true),
|
||||
'action' => array('help' => __d('cake_console', 'Action to inherit'), 'default' => 'all')
|
||||
)
|
||||
)
|
||||
))->addSubcommand('grant', array(
|
||||
'help' => __d('cake_console', 'Grant an ARO permissions to an ACO.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).')
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to grant permission to.'), 'required' => true),
|
||||
'aco' => array('help' => __d('cake_console', 'ACO to grant access to.'), 'required' => true),
|
||||
'action' => array('help' => __d('cake_console', 'Action to grant'), 'default' => 'all')
|
||||
)
|
||||
))->addSubcommand('view', array(
|
||||
'help' => __d('cake_console', 'View a tree or a single node\'s subtree.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "The view command will return the ARO or ACO tree."),
|
||||
__d('cake_console', "The optional node parameter allows you to return"),
|
||||
__d('cake_console', "only a portion of the requested tree.")
|
||||
),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
'node' => array('help' => __d('cake_console', 'The optional node to view the subtree of.'))
|
||||
)
|
||||
)
|
||||
))->addSubcommand('deny', array(
|
||||
'help' => __d('cake_console', 'Deny an ARO permissions to an ACO.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', 'Use this command to deny ACL permissions. Once executed, the ARO specified (and its children, if any) will have DENY access to the specified ACO action (and the ACO\'s children, if any).')
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to deny.'), 'required' => true),
|
||||
'aco' => array('help' => __d('cake_console', 'ACO to deny.'), 'required' => true),
|
||||
'action' => array('help' => __d('cake_console', 'Action to deny'), 'default' => 'all')
|
||||
)
|
||||
))->addSubcommand('initdb', array(
|
||||
'help' => __d('cake_console', 'Initialize the DbAcl tables. Uses this command : cake schema create DbAcl')
|
||||
))->epilog(
|
||||
array(
|
||||
'Node and parent arguments can be in one of the following formats:',
|
||||
'',
|
||||
' - <model>.<id> - The node will be bound to a specific record of the given model.',
|
||||
'',
|
||||
' - <alias> - The node will be given a string alias (or path, in the case of <parent>)',
|
||||
" i.e. 'John'. When used with <parent>, this takes the form of an alias path,",
|
||||
" i.e. <group>/<subgroup>/<parent>.",
|
||||
'',
|
||||
"To add a node at the root level, enter 'root' or '/' as the <parent> parameter."
|
||||
)
|
||||
))->addSubcommand('inherit', array(
|
||||
'help' => __d('cake_console', 'Inherit an ARO\'s parent permissions.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "Use this command to force a child ARO object to inherit its permissions settings from its parent.")
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to have permissions inherit.'), 'required' => true),
|
||||
'aco' => array('help' => __d('cake_console', 'ACO to inherit permissions on.'), 'required' => true),
|
||||
'action' => array('help' => __d('cake_console', 'Action to inherit'), 'default' => 'all')
|
||||
)
|
||||
);
|
||||
)
|
||||
))->addSubcommand('view', array(
|
||||
'help' => __d('cake_console', 'View a tree or a single node\'s subtree.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "The view command will return the ARO or ACO tree."),
|
||||
__d('cake_console', "The optional node parameter allows you to return"),
|
||||
__d('cake_console', "only a portion of the requested tree.")
|
||||
),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
'node' => array('help' => __d('cake_console', 'The optional node to view the subtree of.'))
|
||||
)
|
||||
)
|
||||
))->addSubcommand('initdb', array(
|
||||
'help' => __d('cake_console', 'Initialize the DbAcl tables. Uses this command : cake schema create DbAcl')
|
||||
))->epilog(array(
|
||||
'Node and parent arguments can be in one of the following formats:',
|
||||
'',
|
||||
' - <model>.<id> - The node will be bound to a specific record of the given model.',
|
||||
'',
|
||||
' - <alias> - The node will be given a string alias (or path, in the case of <parent>)',
|
||||
" i.e. 'John'. When used with <parent>, this takes the form of an alias path,",
|
||||
" i.e. <group>/<subgroup>/<parent>.",
|
||||
'',
|
||||
"To add a node at the root level, enter 'root' or '/' as the <parent> parameter."
|
||||
));
|
||||
|
||||
return $parser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that given node exists
|
||||
*
|
||||
* @return boolean Success
|
||||
* @return bool Success
|
||||
*/
|
||||
public function nodeExists() {
|
||||
if (!isset($this->args[0]) || !isset($this->args[1])) {
|
||||
|
@ -552,8 +558,8 @@ class AclShell extends AppShell {
|
|||
* or an array of properties to use in AcoNode::node()
|
||||
*
|
||||
* @param string $class Class type you want (Aro/Aco)
|
||||
* @param string|array $identifier A mixed identifier for finding the node.
|
||||
* @return integer Integer of NodeId. Will trigger an error if nothing is found.
|
||||
* @param string|array|null $identifier A mixed identifier for finding the node, otherwise null.
|
||||
* @return int Integer of NodeId. Will trigger an error if nothing is found.
|
||||
*/
|
||||
protected function _getNodeId($class, $identifier) {
|
||||
$node = $this->Acl->{$class}->node($identifier);
|
||||
|
@ -562,7 +568,7 @@ class AclShell extends AppShell {
|
|||
$identifier = var_export($identifier, true);
|
||||
}
|
||||
$this->error(__d('cake_console', 'Could not find node using reference "%s"', $identifier));
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
return Hash::get($node, "0.{$class}.id");
|
||||
}
|
||||
|
@ -573,8 +579,8 @@ class AclShell extends AppShell {
|
|||
* @return array aro, aco, action
|
||||
*/
|
||||
protected function _getParams() {
|
||||
$aro = is_numeric($this->args[0]) ? intval($this->args[0]) : $this->args[0];
|
||||
$aco = is_numeric($this->args[1]) ? intval($this->args[1]) : $this->args[1];
|
||||
$aro = is_numeric($this->args[0]) ? (int)$this->args[0] : $this->args[0];
|
||||
$aco = is_numeric($this->args[1]) ? (int)$this->args[1] : $this->args[1];
|
||||
$aroName = $aro;
|
||||
$acoName = $aco;
|
||||
|
||||
|
@ -598,12 +604,12 @@ class AclShell extends AppShell {
|
|||
* @return array Variables
|
||||
*/
|
||||
protected function _dataVars($type = null) {
|
||||
if ($type == null) {
|
||||
if (!$type) {
|
||||
$type = $this->args[0];
|
||||
}
|
||||
$vars = array();
|
||||
$class = ucwords($type);
|
||||
$vars['secondary_id'] = (strtolower($class) == 'aro') ? 'foreign_key' : 'object_id';
|
||||
$vars['secondary_id'] = (strtolower($class) === 'aro') ? 'foreign_key' : 'object_id';
|
||||
$vars['data_name'] = $type;
|
||||
$vars['table_name'] = $type . 's';
|
||||
$vars['class'] = $class;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue