Hello people,
I'm having a big problem on the editing a User,
I use the following code:
class UsersController extends AppController {
public function beforeFilter() {
parent::beforeFilter();
}
...........
public function edit($id = null) {
$this->request->data['User']['id'] = $this->Auth->user('id');
if (!( $this->User->exists($id) ) || !( $id ==
$this->Auth->user('id') )) {
$this->Session->setFlash(__('Invalid user'));
$this->redirect('index');
}
if ($this->request->is('post') || $this->request->is('put')) {
/* if ($this->request->data['User']['is_banned'] == true) {
$this->Session->setFlash(__('Conta permanentemente banida, para
reculperá-la mande um e-mail para a adminstração.'), 'default',
array('class' => 'success'));
$this->redirect(array('controller' => 'users', 'action' =>
'logout', 'admin' => false));
} */
if ($this->User->save($this->request->data)) {
$this->Session->setFlash(__('Salvo com sucesso.'), 'default',
array('class' => 'success'));
//$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved.
Please, try again.'));
}
} else {
$options = array('conditions' => array('User.' .
$this->User->primaryKey => $id));
$this->request->data = $this->User->find('first', $options);
}
}
}
VIEW
<div class="users form">
<?php echo $this->Form->create('User'); ?>
<fieldset>
<legend><?php echo __('Editar Usuário'); ?></legend>
<?php
echo $this->Form->input('username');
echo $this->Form->input('password', array(
'value' => ''
));
echo $this->Form->input('is_banned', array(
'label' => __('Desabilitar permanentemente')
));
?>
</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
and this error I get the following error
AclNode :: node () - Could not find Aro node problem identified by "Array
([Aro0.model] => User [Aro0.foreign_key] => 1)"
I am logged in as administrator, I have the following in permições
allowedActions:
(int) 1 => 'index',
(int) 2 => 'add',
(int) 3 => 'login',
(int) 4 => 'view',
(int) 5 => 'logout',
(int) 6 => 'edit',
(int) 7 => 'admin_delete',
(int) 8 => 'admin_logout',
(int) 9 => 'admin_login',
(int) 10 => 'admin_index',
I do not know the cause of this error, however I know that if I remove this
line:
$this->request->data['User']['id'] = $this->Auth->user('id');
the error no longer occurs
helppp mee plzz
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.