CakePHP : DbAcl::allow() - Invalid node [CORE\cake\libs\controller\components\acl.php, line 325]

DbAcl::allow() - Invalid node [CORE\cake\libs\controller\components\acl.php, line 325]
If your following the “Simple Acl Controlled Application” , then you might see the above error message.
A simple fix is, in the function 'initDB()' replace
 $this->Acl->allow($group, 'controllers');
 with
 $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 1), 'controllers');

So the total function would look like the following:


function initDB() {
 $group =& $this->User->Group;
//Allow admins to everything
 $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 1), 'controllers');
 //allow managers to posts and widgets
 $this->Acl->deny(array( 'model' => 'Group', 'foreign_key' => 2), 'controllers');
 $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 2), 'controllers/Posts');
 $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 2), 'controllers/Widgets');

//allow users to only add and edit on posts and widgets
 $this->Acl->deny(array( 'model' => 'Group', 'foreign_key' => 3), 'controllers');
 $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 3), 'controllers/Posts/add');
 $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 3), 'controllers/Posts/edit');
 $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 3), 'controllers/Widgets/add');
 $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 3), 'controllers/Widgets/edit');
}

4 comments:

  1. Hi i used
    $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 1), 'controllers');
    but still getting same error
    any help ?

    ReplyDelete
  2. $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 3), 'controllers/Posts/add');
    i removed the 'controllers' and it worked for me
    $this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 3), 'Posts/add');

    ReplyDelete

Python contextlib for Timing Python code

If you've ever found yourself needing to measure the execution time of specific portions of your Python code, the `contextlib` module o...