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');
}
Hi i used
ReplyDelete$this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 1), 'controllers');
but still getting same error
any help ?
i love you!
ReplyDelete:)
ReplyDelete$this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 3), 'controllers/Posts/add');
ReplyDeletei removed the 'controllers' and it worked for me
$this->Acl->allow(array( 'model' => 'Group', 'foreign_key' => 3), 'Posts/add');