If your User is defined as a "requester" with Acl behavior, the delete
of the user should remove the aro.

On Jun 26, 12:58 pm, "Michael Schmalle" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I'm no genius with cake yet but I see something that might not be right,
>
> In your action, you are not specifying an id to delete.
>
> > $html->link(__('Delete', true), array('action'=>'delete',
>
> $form->value('User.id')), null.....
>
> Shouldn't you have,
>
> $html->link(__('Delete', true),
> array('action'=>'delete/'.$form->value('User.id'), $form->value('User.id')),
> null,....
>
> Mike
>
>
>
> On Thu, Jun 26, 2008 at 3:26 AM, KURT <[EMAIL PROTECTED]> wrote:
>
> > Basically, this is my codes:
>
> > users_controller.php:
> >        function admin_delete($id = null) {
> >                $username = $this->Session->read('user');
> >                $user = $this->Acl->Aro->findByAlias($username);
> >                if ($username) {
> >                        if ($user['Aro']['parent_id'] == 1) { // 1 stands
> > for Kings
> >                                if
> > ($this->Acl->check($this->Session->read('user'), 'Users',
> > 'delete')) {
> >                                        if (!$id && empty($this->data)) {
>
> >  $this->Session->setFlash(__('Invalid User', true));
>
> >  $this->redirect(array('action'=>'index'));
> >                                        }
> >                                        if (!empty($this->data)) {
> >                                                $deleted_user_aro =
> > $this->Acl->Aro->findByAlias($this-
> > >data['User']['username']);
> >                                                $deleted_user_aco =
> > $this->Acl->Aco->findByAlias($this-
> > >data['User']['id'].'-'.$this->data['User']['username']);
> >                                                if ($this->User->del($id)) {
> >                                                        $aro = new Aro();
>
> >  $aro->delete($deleted_user_aro['Aro']['id']);
> >                                                        $aco = new Aco();
>
> >  $aco->delete($deleted_user_aco['Aco']['id']);
>
> >  $this->Session->setFlash(__('User deleted', true));
>
> >  $this->redirect(array('action'=>'index'));
> >                                                } else {
>
> >  $this->Session->setFlash(__('The User could not be saved.
> > Please, try again.', true));
> >                                                }
> >                                        } elseif (empty($this->data)) {
> >                                                $this->data =
> > $this->User->read(null, $id);
> >                                        }
> >                                } else {
> >                                        $this->Session->setFlash('You do not
> > have the permission to do
> > that.');
>
> >  $this->redirect(array('action'=>'index'), null, true);
> >                                }
> >                        } else {
> >                                $this->redirect('/users/', null, true);
> >                        }
> >                } else {
> >                        $this->redirect('/users/login', null, true);
> >                }
> >        }
>
> > admin_delete.ctp:
> > <div class="users form">
> > <?php echo $form->create('User', array('action' => 'delete'));?>
> >        <fieldset>
> >                <legend><?php __('Delete User');?></legend>
> >                <p>Are you sure you want to delete this user? All data about
> > this
> > user will be permanently deleted.</p>
> >        </fieldset>
> > <?php echo $form->end('Delete User');?>
> > </div>
> > <div class="actions">
> >        <ul>
> >                <li><?php echo $html->link(__('Delete', true),
> > array('action'=>'delete', $form->value('User.id')), null,
> > sprintf(__('Are you sure you want to delete # %s?', true), $form-
> > >value('User.id'))); ?></li>
> >                <li><?php echo $html->link(__('List Users', true),
> > array('action'=>'index'));?></li>
> >                <li><?php echo $html->link(__('List Categories', true),
> > array('controller'=> 'categories', 'action'=>'index')); ?> </li>
> >                <li><?php echo $html->link(__('New Category', true),
> > array('controller'=> 'categories', 'action'=>'add')); ?> </li>
> >        </ul>
> > </div>
>
> > so...when I press the 'Delete User' button, it just reloads the page
> > and does nothing and I do not know why, this might be a n00b question,
> > but please help.
>
> --
> Teoti Graphix, LLChttp://www.teotigraphix.com
>
> Teoti Graphix Bloghttp://www.blog.teotigraphix.com
>
> You can find more by solving the problem then by 'asking the question'.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to