Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cakephp:设置ACL允许特定操作并拒绝控制器的其余操作_Php_Cakephp_Acl_Cakephp 2.1 - Fatal编程技术网

Cakephp:设置ACL允许特定操作并拒绝控制器的其余操作

Cakephp:设置ACL允许特定操作并拒绝控制器的其余操作,php,cakephp,acl,cakephp-2.1,Php,Cakephp,Acl,Cakephp 2.1,我正在尝试设置cakephp ACL权限 public function initDB() { $group = $this->User->Group; //root $group->id = 1; $this->Acl->allow($group, 'controllers'); //admin $group->id = 2; $this->Acl->allow($group, 'controllers/Users'); //cliente $

我正在尝试设置cakephp ACL权限

public function initDB() {
$group = $this->User->Group;
//root
$group->id = 1;
$this->Acl->allow($group, 'controllers');
//admin
$group->id = 2;
$this->Acl->allow($group, 'controllers/Users');

//cliente
$group->id = 3;
$this->Acl->deny($group, 'controllers');
$this->Acl->allow($group, 'controllers/Pages');
PROBLEM BELOW ----------------------------------------------
$this->Acl->allow($group, 'controllers/Users/trocar_senha/')
echo "all done";
exit;
}
这也否认了用户的“套管针”行为。但我想允许并拒绝来自用户控制器的所有rest操作

如何允许特定操作并拒绝控制器的所有剩余操作

谢谢

解决了! 问题是
$this->Acl->allow($group,controllers/Users/trocar\u senha/')上的斜杠。

public function initDB() {
    $group = $this->User->Group;
    //root
    $group->id = 1;
    $this->Acl->allow($group, 'controllers');
    //admin
    $group->id = 2;
    $this->Acl->allow($group, 'controllers/Users');

    //cliente
    $group->id = 3;
    $this->Acl->deny($group, 'controllers');
    $this->Acl->allow($group, 'controllers/Pages');
    $this->Acl->allow($group, 'controllers/Users/trocar_senha'); // WHITHOUT SLASH
    echo "all done";
    exit;
}