controller action that checks whether or not the user has update
permission, if not, it displays an error message, and redirects to the
controller index page. Here's the code:
$aroAlias = "User::".$userid;
$acoAlias = "Supplier::".$id;
if ($this->Acl->check($aroAlias, $acoAlias, 'update'))
{
$this->set('supplier', $this->Supplier->read(null, $id));
if (!empty($this->data))
{
if ($this->Supplier->save($this->data))
{
$this->Session->setFlash(__('The Supplier has been saved',
true));
$this->redirect(array('action'=>'index'));
}
else
{
$this->Session->setFlash(__('The Supplier could not be saved.
Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Supplier->read(null, $id);
}
$users = $this->Supplier->User->find('list');
$this->set(compact('users'));
}
else
{
$this->Session->setFlash(__('You are not permitted to edit this
supplier.', true));
$this->redirect(array('action'=>'index'));
}
Now the weird this is, that on first try for an authorized user, it
works, but then, if you refresh the page, or save changes, 7 out of 10
times, I get the 'You are not permitted to edit this supplier' error,
but it never redirects... and updates changes no problem...
Am I missing something?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment