Unable to get CakePHP Cookbook Simple ACL Example Work

I'm having trouble working with ACLs with CakePHP. I worked with the CakePHP Cookbook 2.0 Simple Acl controlled Application example and went through two steps, but I just ran into the same problem.

Everything seems to be configured correctly.

  • I can create my own groups and users.
  • The aros table displays the same rows as shown in the example on the Internet.
  • The acos and aros_acos tables seem to be populated with values ​​that resemble the article.
  • And when I find the page that I want to protect, I get the login page.

But when I log in using the created account, 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] => myemail@somedomain.com [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] 

This account is configured as an administrator, and the group of administrators has been granted access to everything ... so if it works, I should not have problems ... but it seems like there is a lower level problem in my way. I can publish my database tables if this is useful, but thought I'd start here. Thanks for any information you can provide.

0
source share
2 answers

The documentation has been updated to resolve this issue. If you add this to the beforeFilter method in the AppController, this will fix the problem.

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

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

0
source

Source: https://habr.com/ru/post/1333690/


All Articles