繁体   English   中英

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

[英]Cakephp: Setting up ACL allow specific action and deny the rest of actions from controller

我正在尝试设置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;
}

这也拒绝了用户的操作“ trocar_senha”。 但我想允许这样做,并拒绝用户控制器执行所有其余操作。

如何允许采取特定行动并拒绝所有其他管制员?

谢谢!

解决了! 问题是$this->Acl->allow($group, controllers/Users/trocar_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;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM