简体   繁体   English

无法获取CakePHP Cookbook简单ACL示例工作

[英]Unable to Get CakePHP Cookbook Simple ACL Example Working

I'm having problems getting ACL working with CakePHP. 我在使ACL与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. 我一直在使用CakePHP Cookbook 2.0示例Simple Acl控制的Application ,并且已经完成了两次步骤,但是两次都遇到了相同的问题。

Everything appears to be setup correctly. 一切似乎都已正确设置。

  • I'm able to create my groups, and users. 我可以创建我的论坛和用户。
  • The aros table appears to have the same rows shown in the example on the web. aros表似乎具有网上示例中所示的相同行。
  • The acos and aros_acos tables appear to get populated with values that resemble the article. acosaros_acos表似乎填充了类似于该文章的值。
  • And when I visit a page that's setup to be protected, I'm presented with the login page. 当我访问设置为受保护的页面时,会看到登录页面。

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] => 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]

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. 感谢您提供的任何见解。

The documentation was updated to address this issue. 文档已更新,以解决此问题。 If you add this in the beforeFilter method in AppController it resolves the problem. 如果将其添加到AppController的beforeFilter方法中,则可以解决此问题。

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

Add $this->Auth->allow('initDB'); 添加$this->Auth->allow('initDB'); in beforeFilter() 在beforeFilter()中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM