我試圖建立我的ACL在我UsersController了以下行動:CakePHP:設置ACL允許/拒絕不工作(表格未更新)?
class UsersController extends AppController {
var $name = 'Users';
var $helpers = array('Html', 'Form');
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('*');
}
function install() {
$group =& $this->User->Group;
//Allow admins to everything
$group->id = 1;
$this->Acl->allow($group, 'controllers');
//allow users
$group->id = 2;
$this->Acl->deny($group, 'controllers');
$this->Acl->allow($group, 'controllers/Messages');
$this->Acl->allow($group, 'controllers/MessageLists');
$this->Acl->allow($group, 'controllers/Products');
$this->Acl->allow($group, 'controllers/Widgetviews');
}
所以我跟着localhost/users/install
,並在功能呼應一些數字之後,我意識到它跑。然而,蛋糕給我下面的錯誤:
Error: The requested address '/users/install' was not found on this server.
我真的不知道是什麼問題,但我的ACOS /阿羅斯/ aros_acos表都是在此之後保持不變。下面是從下列查詢自己的數據:
mysql> select * from aros_acos a join acos c on a.aco_id=c.id join aros r on a.a
ro_id=r.id
-> ;
+----+--------+--------+---------+-------+---------+---------+----+-----------+-------+-------------+-------------+------+------+----+-----------+-------+-------------+-------+------+------+
| id | aro_id | aco_id | _create | _read | _update | _delete | id | parent_id | model | foreign_key | alias | lft | rght | id | parent_id | model | foreign_key | alias | lft | rght |
+----+--------+--------+---------+-------+---------+---------+----+-----------+-------+-------------+-------------+------+------+----+-----------+-------+-------------+-------+------+------+
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | NULL | NULL | NULL | controllers | 1 | 2 | 1 | NULL | Group | 1 | NULL | 1 | 4 |
| 2 | 2 | 1 | -1 | -1 | -1 | -1 | 1 | NULL | NULL | NULL | controllers | 1 | 2 | 2 | NULL | Group | 2 | NULL | 5 | 10 |
| 3 | 1 | 2 | 1 | 1 | 1 | 1 | 2 | NULL | NULL | NULL | controllers | 3 | 4 | 1 | NULL | Group | 1 | NULL | 1 | 4 |
| 4 | 2 | 2 | -1 | -1 | -1 | -1 | 2 | NULL | NULL | NULL | controllers | 3 | 4 | 2 | NULL | Group | 2 | NULL | 5 | 10 |
+----+--------+--------+---------+-------+---------+---------+----+-----------+-------+-------------+-------------+------+------+----+-----------+-------+-------------+-------+------+------+
4 rows in set (0.00 sec)
編輯: 我已經調試設置爲0,所以它切換到2後,我收到以下警告:
Warning (512): AclNode::node() - Couldn't find Aro node identified by "Array
(
[Aro0.model] => Group
[Aro0.foreign_key] => 1
)
" [CORE\cake\libs\model\db_acl.php, line 191]
Warning (512): DbAcl::allow() - Invalid node [CORE\cake\libs\controller\components\acl.php, line 324]
Warning (512): AclNode::node() - Couldn't find Aro node identified by "Array
(
[Aro0.model] => Group
[Aro0.foreign_key] => 2
)
" [CORE\cake\libs\model\db_acl.php, line 191]
我還重創建了我的DbAcl,它填充了acos
表,但不包含aros
或aros_acos
表。上面的警告是我正在嘗試再次運行install
操作。
我一定是把它關閉在星期五:\我」我用警告更新了我的帖子。 – Garrett 2012-01-09 19:30:16
這是我的壞 - 我只需重新創建組和用戶後,我重新創建了DbAcl,以便他們將註冊爲ARO。謝謝! – Garrett 2012-01-09 20:01:30