本文介绍了CakePHP ACL提供错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的AppController.php

I've set this in my AppController.php

    $this->Auth->authorize = array(
    'Actions' => array(
        'actionPath' => 'controllers/'
    )
);

这是在我的Aco表中:

This is in my Aco table:

id  parent_id   model   foreign_key     alias   lft     rght
25  NULL             NULL   NULL    controllers     1   2

这是我的Aro表:

id  parent_id   model   foreign_key     alias   lft     rght
1   1           Group   1               NULL      27    30
15  14          User    1               NULL      28    29

这是我的Aco_Aro表:

This is my Aco_Aro table:

id  aro_id  aco_id  _create     _read   _update     _delete
15    1       25      1             1     1            1

我收到此错误:

    Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check.  Node references:
Aro: Array
(
    [User] => Array
        (
            [id] => 1
            [username] => Test
            [group_id] => 1
            [created] => 2012-03-24 22:47:33
            [modified] => 2012-03-24 22:47:33
        )

)

Aco: controllers/Posts/index


推荐答案

用户测试属于Aro表中显示的Aro 14 。表Aro中的parent_id字段定义了树。

The user Test belongs the Aro 14 as seen in your Aro table. The parent_id field in the table Aro defines the tree.

// For eg. If i have two groups Administrator, User
Groups
id | name
11 | Administrator
22 | User


用户
//我的用户表为

And Users // I have users table as

id | name | group_id
 7 |  KK  |    11
 9 |  SS  |    22

我的Aro表将是

ARO
id | parent_id | alias | foreign_key  
 1 |   null    |  adm  |   11            // Group
 2 |   null    |  usr  |   22            // Group
 3 |    1      |  kk   |   7            // User
 4 |    2      |  SS   |   9            // User

在Aro / Acl设置中,cake的ACL组件找不到 14
如果你想让你的生活更轻松,你可以尝试。这真的简化了一些明显的任务。

From your Aro/Acl setup, cake's ACL component is not able to find 14. If you want to make your life easier you can try Acl Plugin. This really simplifies some obvious tasks.

这篇关于CakePHP ACL提供错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 10:02