DbAcl::allow() – Invalid node [CORE\cake\libs\controller\components\acl.php, line 325]
This is a part of my Guide to setting up the CakePHP auth component series.
And it was all going so well until…
DbAcl::allow() - Invalid node [CORE\cake\libs\controller\components\acl.php, line 325]
This is an error you’re likely to encounter if you follow the “Simple Acl Controlled Application” word for word. I’ve not got to the bottom of whether this should or ever did actually work but the fix for it is to redefine how the administrators are granted full access to everything. By the time you get to page http://book.cakephp.org/view/648/Setting-up-permissions everything should be looking good, until you try to implement:
//Allow admins to everything $group->id = 1; $this->Acl->allow($group, 'controllers');
I believe the issue is caused because the admin item no alias set up when using the auto populate functions in the tutorial so to get around this you must pass in an explicit array of attributes to indicate which group you’re talking about.
$this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 1), 'controllers');
This is actually a very useful error because the syntax above (i.e. with the array as the first parameter can be used when working with other ACL functions).
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.
Comments
I didn’t solve it, I only used shell version, it works perfectly for the same things.
But now I have another problem.
I have this warning message when I try to log in:
Warning (512): DbAcl::check() – Failed ARO/ACO node lookup in permissions check.
My login function exactly the same what in the tutorial (http://book.cakephp.org/).
Can you help me with this?
I tried using this in my users controller: http://bin.cakephp.org/view/1547890968, but get the same error.
Hi
thanks for help.
now my authentication works perfectly.
my first problem was that I didn’t properly fill tables aros and acos and tried to fill table aros_acos.
And I had second warning
Warning (512): DbAcl::check() – Failed ARO/ACO node lookup in permissions check.
because in table acos I put only controllers, but we should put actions too which have parent_id = their controllers.
p.s. sorry for my bad english, I hope my words are clear.
The setting up permission page is a rather difficult page to read.
The top section that reads
“Creating permissions much like creating ACO’s has no magic solution, nor will I be providing one. To allow ARO’s access to ACO’s from the shell interface use the AclShell. For more information on how to use it consult the aclShell help which can be accessed by running:”
Do we have to figure out how to set these permissions before moving on to the rest of the page?
Next:
what does this mean
“To allow with the AclComponent do the following:
$this->Acl->allow($aroAlias, $acoAlias);”
and where does this line go?
Next:
I changed the line as you said above in the initDB function but i am still getting the error.
Any help would be great. Thanks so much
Hi there, thanks for the heads up on this one. Just in case any one else had the same error as me, I found that the build_acl script that is found on the Cakephp site adds an extra ‘controller’ actino to the ‘Users’ in the aco table.
This meant that even with this workaround, as soon as I tried to deny a usergroup from controllers/Users/delete, I was getting an error again. I don’t have an action in the users_controller called controllers so this is a very strange one. I am using cakephp 1.3 and had no problems with 1.2 on this subject.
I removed the Users/controllers from the acl and then it worked, using the above array as the first parameter.
I was getting the following error even though the user had been wiped from my DB. Ran it in a different browser and the problem went so must be a caching issue. Tried the suggestions above but that didn’t help.
Warning (512): AclNode::node() – Couldn’t find Aro node identified by \Array
(
[Aro0.model] => User
[Aro0.foreign_key] => 2
)
\ [COREcakelibsmodeldb_acl.php, line 191]
Code | Context
if (!$result) {
trigger_error(sprintf(__(\AclNode::node() – Couldn’t find %s node identified by \%s\\, true), $type, print_r($ref, true)), E_USER_WARNING);
$this = Aro
Aro::$name = \Aro\
Aro::$hasAndBelongsToMany = array
Aro::$cacheQueries = false
Aro::$actsAs = array
Aro::$useDbConfig = \default\
Aro::$useTable = \aros\
Aro::$displayField = \id\
Aro::$id = false
Aro::$data = array
Aro::$table = \aros\
Aro::$primaryKey = \id\
Aro::$_schema = array
Aro::$validate = array
Aro::$validationErrors = array
Aro::$tablePrefix = \\
Aro::$alias = \Aro\
Aro::$tableToModel = array
Aro::$logTransactions = false
Aro::$belongsTo = array
Aro::$hasOne = array
Aro::$hasMany = array
Aro::$Behaviors = BehaviorCollection object
Aro::$whitelist = array
Aro::$cacheSources = true
Aro::$findQueryType = NULL
Aro::$recursive = 1
Aro::$order = NULL
Aro::$virtualFields = array
Aro::$__associationKeys = array
Aro::$__associations = array
Aro::$__backAssociation = array
Aro::$__insertID = NULL
Aro::$__numRows = NULL
Aro::$__affectedRows = NULL
Aro::$_findMethods = array
Aro::$Aco = Aco object
Aro::$Permission = Permission object
$ref = array(
\Aro0.model\ => \User\,
\Aro0.foreign_key\ => \2\
)
$db = DboMysql
DboMysql::$description = \MySQL DBO Driver\
DboMysql::$_baseConfig = array
DboMysql::$startQuote = \`\
DboMysql::$endQuote = \`\
DboMysql::$_useAlias = true
DboMysql::$_commands = array
DboMysql::$fieldParameters = array
DboMysql::$tableParameters = array
DboMysql::$columns = array
DboMysql::$index = array
DboMysql::$alias = \AS \
DboMysql::$methodCache = array
DboMysql::$cacheMethods = true
DboMysql::$__bypass = true
DboMysql::$__sqlOps = array
DboMysql::$virtualFieldSeparator = \__\
DboMysql::$connected = true
DboMysql::$fullDebug = true
DboMysql::$error = NULL
DboMysql::$affected = 0
DboMysql::$numRows = 0
DboMysql::$took = 0
DboMysql::$_result = resource
DboMysql::$_queriesCnt = 7
DboMysql::$_queriesTime = 0
DboMysql::$_queriesLog = array
DboMysql::$_queriesLogMax = 200
DboMysql::$_queryCache = array
DboMysql::$__descriptions = array
DboMysql::$_sources = array
DboMysql::$connection = resource
DboMysql::$config = array
DboMysql::$configKeyName = \default\
DboMysql::$_transactionStarted = false
DboMysql::$cacheSources = true
DboMysql::$results = resource
DboMysql::$map = array
DboMysql::$__booleans = array
$type = \Aro\
$result = array()
$table = \aros\
$name = \User\
$model = User
User::$name = \User\
User::$displayField = \full_name\
User::$actsAs = array
User::$validate = array
User::$belongsTo = array
User::$useDbConfig = \default\
User::$useTable = \users\
User::$id = false
User::$data = array
User::$table = \users\
User::$primaryKey = \id\
User::$_schema = array
User::$validationErrors = array
User::$tablePrefix = \\
User::$alias = \User\
User::$tableToModel = array
User::$logTransactions = false
User::$cacheQueries = false
User::$hasOne = array
User::$hasMany = array
User::$hasAndBelongsToMany = array
User::$Behaviors = BehaviorCollection object
User::$whitelist = array
User::$cacheSources = true
User::$findQueryType = NULL
User::$recursive = 1
User::$order = NULL
User::$virtualFields = array
User::$__associationKeys = array
User::$__associations = array
User::$__backAssociation = array
User::$__insertID = NULL
User::$__numRows = NULL
User::$__affectedRows = NULL
User::$_findMethods = array
User::$Group = Group object
User::$Client = Client object
User::$Aro = Aro object
$tmpRef = null
$val = \2\
$key = \foreign_key\
$queryData = array(
\conditions\ => array(
\Aro0.model\ => \User\,
\Aro0.foreign_key\ => \2\
),
\fields\ => array(
\id\,
\parent_id\,
\model\,
\foreign_key\,
\alias\
),
\joins\ => array(
array()
),
\order\ => \`Aro`.`lft` DESC\
)
AclNode::node() – COREcakelibsmodeldb_acl.php, line 191
DbAcl::check() – COREcakelibscontrollercomponentsacl.php, line 269
AclComponent::check() – COREcakelibscontrollercomponentsacl.php, line 92
AuthComponent::isAuthorized() – COREcakelibscontrollercomponentsauth.php, line 527
AuthComponent::startup() – COREcakelibscontrollercomponentsauth.php, line 445
Component::triggerCallback() – COREcakelibscontrollercomponent.php, line 186
Controller::startupProcess() – COREcakelibscontrollercontroller.php, line 527
Dispatcher::_invoke() – COREcakedispatcher.php, line 187
Dispatcher::dispatch() – COREcakedispatcher.php, line 171
[main] – APPwebrootindex.php, line 83
Warning (512): DbAcl::check() – Failed ARO/ACO node lookup in permissions check. Node references:
Aro: Array
(
[User] => Array
(
[id] => 2
[full_name] => Jo Bloggs
[email] => example@gmail.com
[client_id] =>
[username] => Tom
[temp_password] =>
[user_filter_list] =>
[email_enabled] => 1
[last_login_date] =>
[group_id] => 1
[is_enabled] => 1
[created] => 2010-08-06 23:44:52
[modified] => 2010-08-06 23:44:52
)
)
Same error for me :
Warning (512): AclNode::node() – Couldn’t find Aro node identified by “Array
(
[Aro0.model] => Group
[Aro0.foreign_key] => 1
)
” [CORE/cake/libs/model/db_acl.php, line 191]Code | Context
if (!$result) {
trigger_error(sprintf(__(“AclNode::node() – Couldn’t find %s node identified by \”%s\”", true), $type, print_r($ref, true)), E_USER_WARNING);$this = Aro
Aro::$name = “Aro”
Aro::$hasAndBelongsToMany = array
Aro::$cacheQueries = false
Aro::$actsAs = array
Aro::$useDbConfig = “default”
Aro::$useTable = “aros”
Aro::$displayField = “id”
Aro::$id = false
Aro::$data = array
Aro::$table = “aros”
Aro::$primaryKey = “id”
Aro::$_schema = array
Aro::$validate = array
Aro::$validationErrors = array
Aro::$tablePrefix = “”
Aro::$alias = “Aro”
Aro::$tableToModel = array
Aro::$logTransactions = false
Aro::$belongsTo = array
Aro::$hasOne = array
Aro::$hasMany = array
Aro::$Behaviors = BehaviorCollection object
Aro::$whitelist = array
Aro::$cacheSources = true
Aro::$findQueryType = NULL
Aro::$recursive = 1
Aro::$order = NULL
Aro::$virtualFields = array
Aro::$__associationKeys = array
Aro::$__associations = array
Aro::$__backAssociation = array
Aro::$__insertID = NULL
Aro::$__numRows = NULL
Aro::$__affectedRows = NULL
Aro::$_findMethods = array
Aro::$Aco = Aco object
Aro::$Permission = Permission object
$ref = array(
“Aro0.model” => “Group”,
“Aro0.foreign_key” => “1″
)
$db = DboMysqli
DboMysqli::$description = “Mysqli DBO Driver”
DboMysqli::$_baseConfig = array
DboMysqli::$startQuote = “`”
DboMysqli::$endQuote = “`”
DboMysqli::$_useAlias = true
DboMysqli::$_commands = array
DboMysqli::$fieldParameters = array
DboMysqli::$tableParameters = array
DboMysqli::$columns = array
DboMysqli::$index = array
DboMysqli::$alias = “AS ”
DboMysqli::$methodCache = array
DboMysqli::$cacheMethods = true
DboMysqli::$__bypass = true
DboMysqli::$__sqlOps = array
DboMysqli::$virtualFieldSeparator = “__”
DboMysqli::$connected = true
DboMysqli::$fullDebug = true
DboMysqli::$error = NULL
DboMysqli::$affected = 0
DboMysqli::$numRows = 0
DboMysqli::$took = 0
DboMysqli::$_result = mysqli_result object
DboMysqli::$_queriesCnt = 13
DboMysqli::$_queriesTime = 12
DboMysqli::$_queriesLog = array
DboMysqli::$_queriesLogMax = 200
DboMysqli::$_queryCache = array
DboMysqli::$__descriptions = array
DboMysqli::$_sources = array
DboMysqli::$connection = mysqli object
DboMysqli::$config = array
DboMysqli::$configKeyName = “default”
DboMysqli::$_transactionStarted = false
DboMysqli::$cacheSources = true
DboMysqli::$results = mysqli_result object
DboMysqli::$map = array
DboMysqli::$__booleans = array
$type = “Aro”
$result = array()
$table = “aros”
$val = “1″
$key = “foreign_key”
$queryData = array(
“conditions” => array(
“Aro0.model” => “Group”,
“Aro0.foreign_key” => “1″
),
“fields” => array(
“id”,
“parent_id”,
“model”,
“foreign_key”,
“alias”
),
“joins” => array(
array()
),
“order” => “`Aro`.`lft` DESC”
)AclNode::node() – CORE/cake/libs/model/db_acl.php, line 191
DbAcl::getAclLink() – CORE/cake/libs/controller/components/acl.php, line 462
DbAcl::allow() – CORE/cake/libs/controller/components/acl.php, line 356
AclComponent::allow() – CORE/cake/libs/controller/components/acl.php, line 106
UsersController::admin_initDB() – APP/controllers/users_controller.php, line 28
Dispatcher::_invoke() – CORE/cake/dispatcher.php, line 204
Dispatcher::dispatch() – CORE/cake/dispatcher.php, line 171
[main] – APP/webroot/index.php, line 83
I use :
$this->Acl->allow(array(‘model’=>’Group’, ‘foreign_key’=>’1′), ‘controllers’);
But it doesn’t work
Please help

Did you try it? Looks like it doesn’t work. I have this problem but it didn’t help me.