⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

how to prevent to edit columns where is not in our list ?



ali_fattahi
  • profile picture
  • Member

Posted 28 January 2013 - 18:38 PM

hello guys
I have a list that I limited by [b]where [/b]function in grocerycrud and all things is ok and it limits results. but in edit I can change the column id in url and edit that columns which is not in the list and I don't want to edit that columns , how can i solve this problem ?
in addition, the delete have the same problem.
best regards
Ali

victor
  • profile picture
  • Member

Posted 28 January 2013 - 19:38 PM

You can check the "category_id" in your controller:

ali_fattahi
  • profile picture
  • Member

Posted 28 January 2013 - 19:51 PM

I Handled the problem with another solution .
here is my code


$output = $crud->render();
$state = $crud->getState();
$state_info = $crud->getStateInfo();
if ($state=='edit' || $state=='delete')
{
$id = $state_info->primary_key;
if ($this->BlogCategoryModel->getOwner($id)==$this->user_id)
$this->_example_output($output);
else
{
$this->oi->add_error('Some ERROR Message');
$this->load->view('main');
}
}
else
{
$this->_example_output($output);
}