Dave
Dave

Reputation: 1189

Unable to Get CakePHP Cookbook Simple ACL Example Working

I'm having problems getting ACL working with CakePHP. I've been working with the CakePHP Cookbook 2.0 example Simple Acl controlled Application, and have gone through the steps twice, but I've run into the same problem both times.

Everything appears to be setup correctly.

But when I login using the account I created, I see the following error:

Warning (512): DbAcl::check() - 
Failed ARO/ACO node lookup in permissions check.  Node     references:
Aro: Array
(
[User] => Array
    (
        [id] => 1
        [username] => dc
        [email] => [email protected]
        [group_id] => 1
        [created] => 2011-10-27 14:58:59
        [modified] => 2011-10-27 14:58:59
    )
)  
Aco: /Posts/add [CORE/Cake/Controller/Component/AclComponent.php, line 303]

That account is setup as an administrator, and the administrator group has been granted access to everything ... so if it works, I shouldn't have a problem ... but it seems like there's a lower-level problem that's getting in my way. I can post my DB tables as well if that'd be helpful, but figured I'd start here. Thanks for any insight you can provide.

Upvotes: 0

Views: 539

Answers (2)

Anil kumar
Anil kumar

Reputation: 4177

Add $this->Auth->allow('initDB'); in beforeFilter()

Upvotes: 0

Dave
Dave

Reputation: 1189

The documentation was updated to address this issue. If you add this in the beforeFilter method in AppController it resolves the problem.

$this->Auth->authorize = array(
    AuthComponent::ALL => array('actionPath' => 'controllers'),
    'Actions',
);

Upvotes: 1

Related Questions