无法使 CakePHP Cookbook 简单 ACL 示例正常工作

发布于 2024-12-12 10:18:37 字数 1219 浏览 0 评论 0原文

我在 ACL 与 CakePHP 一起使用时遇到问题。我一直在使用 CakePHP Cookbook 2.0 示例 简单的 Acl 控制的应用程序,并且已经执行了两次这些步骤,但两次都遇到了相同的问题。

一切似乎都设置正确。

  • 我能够创建我的组和用户。
  • aros 表似乎具有与网络示例中显示的相同的行。
  • acosaros_acos 表似乎填充了与文章类似的值。
  • 当我访问设置为受保护的页面时,我会看到登录页面。

但是,当我使用我创建的帐户登录时,我看到以下错误:

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]

该帐户被设置为管理员,并且管理员组已被授予对所有内容的访问权限......所以如果它有效,我应该不会有问题。 ..但似乎有一个较低级别的问题阻碍了我。如果有帮助的话,我也可以发布我的数据库表,但我想我应该从这里开始。感谢您提供的任何见解。

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.

  • 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.
  • The acos and aros_acos tables appear to get populated with values that resemble the article.
  • 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] => [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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

花辞树 2024-12-19 10:18:37

更新了文档以解决此问题。如果您将其添加到 AppController 的 beforeFilter 方法中,则可以解决该问题。

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

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',
);
热风软妹 2024-12-19 10:18:37

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文