I'm trying to implement ACL for my already created application and
need to create the aro records for my current existent users. On IRC
Ceeram said i just need to load AclBehaviour into my User's model,
find all users and save it (update any field, i guess) and that will
create the ARO row. I triedy but it doesn't works, it return me an
error:
AclNode::node() - Couldn't find Aro node identified by
"Array ( [Aro0.model] => User [Aro0.foreign_key] => 1 )
"
this is my current code:
/ User actsAs... acl => requester
//user model:
// i don't want to have a groups table. i have rol field as ENUM in my
user table for group
public function parentNode() {
if (!$this->id && empty($this->data)) {
return null;
}
if (isset($this->data['User']['rol'])) {
$groupId = $this->data['User']['rol'];
} else {
$groupId = $this->field('rol');
}
if (!$groupId) {
return null;
} else {
return $groupId;
}
}
//user controller
function init_acl_db(){
$this->User->recursive = -1;
$users = $this->User->find('all');
foreach ($users as $u) {
$this->User->create();
$this->User->id = $u['User']['id'];
$this->User->saveField('modified', date('Y-m-d h:i:s'));
// this returns me this error: AclNode::node() - Couldn't find
Aro node identified by "Array ( [Aro0.model] => User
[Aro0.foreign_key] => 1 ) "
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment