cake Acl.Extras recover aro
cake Acl.Extras recover aco
cake Acl.Extras verify aro
cake Acl.Extras verify aco
cake Acl.Extras aco_sync_contents Users.User
cake Acl.Extras aco_update
cake Acl.Extras aco_sync
// One of these creates duplicated rows in "aros" table, but not the one I need (foreign_key=14)
cake acl create aro parent_ARO User.user_id
cake acl create aro 0 Users
public function admin_fix_aros(){
$this->autoRender =
$this->loadModel('Aro');
$users = $this->User->find('all');
foreach ($users as $user) {
$params = array('conditions' => array(
'model' => 'User',
'foreign_key' => $user['User']['id'],
'parent_id' => $user['User']['role_id'],
));
$aro = $this->Aro->find('first', $params);
// Create new ARO
if(!count($aro)){
debug('CREATING ARO FOR USER '.$user['User']['id'].' > '.$user['User']['name']);
$this->Aro->create();
$this->Aro->save(array(
'model' => 'User',
'foreign_key' => $user['User']['id'],
'parent_id' => $user['User']['role_id'],
'alias' => $user['User']['username'],
));
}
// Override ARO
else{
$this->Aro->save(array(
'id' => $aro['Aro']['id'],
'model' => 'User',
'foreign_key' => $user['User']['id'],
'parent_id' => $user['User']['role_id'],
'alias' => $user['User']['username'],
));
}
}
}
Hello, I´m stuck with this from a long time, I came to ask for some help.I automatically create users importing a CSV. Some of this users don´t have a related row at the "aros" table, I don´t know why.When launching a script that applies uppercase to all the usernames, the ones that don´t have a related aro fail to save.The error is: [CakeException] AclNode::node() - Couldn't find Aro node identified by "Array ( [Aro0.model] => User [Aro0.foreign_key] => 14 )This is true: in the "aros" table there isn´t any row with Model = User and foreign_key = 14.I found the console tool to regenerate and repair ACL trees, also to sync content, but none of this commands regenerated the right ARO for this user.Any help would be appreciated.
$patched = $this->Users->newEntity($userData);
$save = $this->Users->save( $patched );
$this->Users = TableRegistry::get('Users');
$this->Users = TableRegistry::get('Croogo/Users.Users');
$patched = $this->Users->newEntity($relatedData, ['validate' => false]);