1
votes

im going through http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html <--- this tutorial and guess what? ;) it doesnt work, im Using cakephp 2.2.2... i get next error

Undefined index: id [CORE/Cake/Model/AclNode.php, line 140]

AclNode::node() - Couldn't find Aro node identified by "Array ( [Aro0.model] => User [Aro0.foreign_key] => ) " Error: An Internal Error Has Occurred.

this error is becouse i dont get my group_id in my User model

public function bindNode($user) {
            return array('model' => 'Groups', 'foreign_key' => $user['Users']['groups_id']);
        }

So in this function $user var contains only username and password... and no group_id's

Please help guys...

2

2 Answers

1
votes

Model name must be singular.

'model' => 'Group'
$user['Users']['group_id'] //in your DB, put "group_id" to, not "groups_id"

Make sure that the Model you've created is "Group". :)

0
votes

I've just encountered this problem. Tracing the code back the issue was that my model was called 'AdminUser' and not the default, 'User'. Altering the userModel setting solved it for me.

public $components = array(
    'Acl', 
    'Auth' => array(
        'authorize' => array(
            'Actions' => array(
                'actionPath' => 'controllers',
                'userModel' => 'AdminUser'
            )
        )
    ), 
    'Session'
);

Looking at your bindNode method it looks like your using a model named 'Users' rather than 'User' so setting the userModel to 'Users' might do the trick.

I hope that helps,
Pete