FMCorz / AclManager

Plugin to manage Acl for CakePHP 2.x
59 stars 33 forks source link

fails if too many ACOs #15

Closed gmotyl closed 10 years ago

gmotyl commented 10 years ago

Hi, This is great plugin but there is a problem when you have too many ACOs and AROs. I have 359 ACOs in my App and 4 Groups (ARO). Plugin is changing permissions only for first 3 Groups, 4th group permissions are unchanged... I have noticed that this issue is related to number of ACOs and AROs.... reg. gom3s

FMCorz commented 10 years ago

Hi,

thanks for the report. I think this issue is caused by the PHP ini setting 'max_input_vars' which limits to 1000 variables to be passed by default. Unfortunately it is not easy to bypass. Unless reading the variables directly from "php://input".

Could you please try to increase your 'max_input_vars' setting. Also, I'm pretty sure that the last ACOs on the 3rd group won't be saved either.

Cheers, Fred

gmotyl commented 10 years ago

I have managed to bypass this issue, by adding Aco filter GET param AclController.php:

public function permissions($filter = null) {

(...)
    /**
     * Build permissions info
     */
$parent = !empty($filter) ? $this->Acl->Aco->find('first', array('conditions' => array('Aco.alias LIKE "%' . $filter .'%"'))): null;
$conditions = !empty($filter) ? array(
  'OR' => array(
    array('Aco.parent_id' => $parent['Aco']['id']), 
    array(array('Aco.id' => $parent['Aco']['id'])), 
    array(array('Aco.lft' => 1)
  ))) : null;

$this->acos = $this->Acl->Aco->find('all', array('order' => 'Aco.lft ASC', 'recursive' => 1));
$acos = $this->Acl->Aco->find('all', array('order' => 'Aco.lft ASC', 'recursive' => 1, 'conditions' => $conditions));

(...)

And in view simple linkt to filter one controller only permissions.ctp line 33:

 <td><?php echo ($ident == 1 ? $this->Html->link($alias, array('action' => 'permissions', $alias)) : h($alias)); ?></td>