0
votes

I'm trying to setup the cakephp ACL permissions.

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;
}

This is denying the action "trocar_senha" from Users too. But i want to allow that and deny all rest actions from users controller.

How to allow specific action and deny all the rest from controller?

Thanks!

1

1 Answers

0
votes

Solved! The problem was the slash on $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;
}