创建具有 aro 和 aco 的 aro/aco

发布于 2024-10-19 10:02:51 字数 1239 浏览 5 评论 0原文

我正在尝试在我的应用程序中实现 PDF 功能。因此,我在控制器中添加了一些新操作(例如“viewpdf”)。 之后,我使用 build_acl 操作重建 ACL 树(来自 Mark Story 教程 用于创建 ACOS 的自动化工具 )。 因此,我可以通过 MySQL 看到创建了一个新节点。 在此之前,一切都很好。但现在我尝试测试 viewpdf 按钮,但收到“您无权访问该位置”的消息。错误(即使是管理员)。我检查 error.log 文件,看到一条警告:

> Aco: controllers/Specializations/viewpdf in [/usr/share/php/cake/libs/controller/components/acl.php, line 273]
2011-02-24 11:40:34 Warning: Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check.  Node references:
Aro: Array
(
    [User] => Array
        (
            [id] => 1
            [email] => [email protected]
            [group_id] => 1
        )

)

Aco: controllers/Specializations/viewpdf in [/usr/share/php/cake/libs/controller/components/acl.php, line 273]

然后我检查数据库中的 aros_acos 表,发现没有与任何节点相关的“viewpdf”ACO,因此有一个 ARO、一个 ACO,但没有 ARO_ACO,所以我想这就是我收到此错误的原因。

我的假设正确吗?如果是的话,我该如何创建这个 aro_aco?我担心如果我手动执行的话,我可能会破坏任何东西......

提前致谢,

阿尔夫。

I'm trying to implement PDF functionality to my application. So, I added some new actions in controllers (like 'viewpdf').
After this, I rebuild the ACL tree with the build_acl action (from Mark Story Tutorial Automated tool for creating ACOS ).
So, I can see with MySQL that a new node is created.
Until this, everything is fine. But now I try to test the viewpdf button, and I get a 'You are not authorized to access that location.' error (even being admin). I check the error.log file and I see a warning:

> Aco: controllers/Specializations/viewpdf in [/usr/share/php/cake/libs/controller/components/acl.php, line 273]
2011-02-24 11:40:34 Warning: Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check.  Node references:
Aro: Array
(
    [User] => Array
        (
            [id] => 1
            [email] => [email protected]
            [group_id] => 1
        )

)

Aco: controllers/Specializations/viewpdf in [/usr/share/php/cake/libs/controller/components/acl.php, line 273]

Then I check the aros_acos table in the database and I see that there's no 'viewpdf' ACO related to any node, so there's an ARO, an ACO, but not an ARO_ACO, so I suppose that this is the reason why I'm getting this error.

¿Are my suppositions right? If they are, how could I create this aro_aco? I'm afraid that I could break anything if I do it manually...

Thanks in advance,

Alf.

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

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

发布评论

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

评论(2

痴梦一场 2024-10-26 10:02:51

alfizqu,

如果您有 ARO 和 ACO,但它们之间没有通过 ACO_ARO 表中的条目进行连接,这意味着您尚未设置 ARO 对 ACO 的权限。

像这样继续:

/*
 * Copied from the tutorial, and modified, this function initializes the per-
 * missions for accessing controller actions.
 */
  function initDB() {
    $group =& $this->User->Group;

    // A D M I N S
    $group->id = 3;     
    $this->Acl->allow($group, 'controllers');

    // M A N A G E R S
    $group->id = 2;
    $this->Acl->deny($group, 'controllers');
    $this->Acl->allow($group, 'controllers/Items','*'); ... ...

一旦设置了这样的 initDB 函数,您必须通过从浏览器调用它来运行它一次。
如果这不足以帮助您回到正轨,只需再次查看基本的 AUTH/ACL 教程即可。
你的,本杰明。

编辑1:
关键点之一是在自定义控制器的 beforeFilter() 方法中调用 parent::beforeFilter() 并正确设置 app_controller< /代码>。
如果这些提示没有帮助,最省时的方法是从新鲜的蛋糕环境开始,非常仔细地阅读 ACL/AUTH 教程。一旦您可以在那里启动并运行它,您就有信心在您的应用程序中执行此操作。

编辑2:
并且不要害怕丢弃与应用程序相关的所有 ACL/AUTH。这听起来令人畏惧,但它可以避免大量调试麻烦/时间。

PS:顺便说一句,面包店和 sourceforge 应该有一些适度可用的 ACL/AUTH 插件。

alfizqu,

if you have an ARO and an ACO but no connection between these by means of entries in the ACO_ARO table, this means you have not set up the permissions your AROs have on the ACOs.

Proceed like this:

/*
 * Copied from the tutorial, and modified, this function initializes the per-
 * missions for accessing controller actions.
 */
  function initDB() {
    $group =& $this->User->Group;

    // A D M I N S
    $group->id = 3;     
    $this->Acl->allow($group, 'controllers');

    // M A N A G E R S
    $group->id = 2;
    $this->Acl->deny($group, 'controllers');
    $this->Acl->allow($group, 'controllers/Items','*'); ... ...

Once you have set up such an initDB function, you have to run it once by calling it from your browser.
If this does not suffice to help you back on the track, just go over the basic AUTH/ACL tutorial again.
Yours, Benjamin.

Edit 1:
One of the crucial points is to call the parent::beforeFilter() in the beforeFilter() methods of self-defined controllers and properly setting up the app_controller.
If these tips do not help, the most time-efficient way is to go over the ACL/AUTH tutorial very carefully, starting from a fresh cake environment. Once you can get it up and running there, you are confident to do it in your app.

Edit 2:
And don't be afraid to throw out everything ACL/AUTH related of your app. It just sounds daunting, but it can safe a lot of debugging headaches/time.

P.S.: Btw there should be some moderately usable ACL/AUTH plugins at the bakery and one at sourceforge.

缱倦旧时光 2024-10-26 10:02:51

尝试在用户控制器中创建一个示例操作,如下所示

function install(){
     $aco = new Aco();
     $aco->create();
     $aco->save(array(
         'parent_id' => <Id of the Specializations in acos table>,
     'alias' => 'viewpdf',
     ));


    $this->Acl->allow('admin','controllers/Specializations/viewpdf','*');
}

如果您运行该操作,将在 acos 表中创建一个新的 Aco 节点。对于管理员用户,您可以授予全部权限。您可以使用任何有效用户(用户名应在 Aros 表中)代替管理员。

希望有帮助。

Try to create an sample action in users controller like this

function install(){
     $aco = new Aco();
     $aco->create();
     $aco->save(array(
         'parent_id' => <Id of the Specializations in acos table>,
     'alias' => 'viewpdf',
     ));


    $this->Acl->allow('admin','controllers/Specializations/viewpdf','*');
}

If u run the action the a new Aco node will be created in acos table. and for the admin user u can give the whole permission.you can use any valid user (username should be in Aros table) instead admin.

hope it helps.

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