无法获取CakePHP Cookbook简单ACL示例工作 [英] Unable to Get CakePHP Cookbook Simple ACL Example Working

查看:190
本文介绍了无法获取CakePHP Cookbook简单ACL示例工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用CakePHP处理ACL。我一直在使用CakePHP Cookbook 2.0示例简单的Acl控制应用程序,并已经执行了两次步骤,但我遇到了同样的问题两次。

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.

一切似乎设置正确。


  • 我的群组和使用者。

  • aros 表格似乎与网络上的示例中显示的行相同。

  • acos aros_acos 表格似乎会填充类似文章的值。

  • 当我访问的网页
  • 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] => 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.

推荐答案

文档已更新,以解决此问题。如果你在AppController的beforeFilter方法中添加它,它会解决这个问题。

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',
);

这篇关于无法获取CakePHP Cookbook简单ACL示例工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆