FMCorz / AclManager

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

Aro Primary Key on permissions.ctp with special primary key #18

Open tranfuga25s opened 10 years ago

tranfuga25s commented 10 years ago

When using Aros with personalized primary key's this changed should be done:

In AclController.php line 146 add:

$this->set('aroPk', $Aro->primaryKey );

in permissions.ctp change from line 29:

$inherit = $this->Form->value("Perms." . str_replace("/", ":", $action) . ".{$aroAlias}:{$aro[$aroAlias][$aroPk]}-inherit"); $allowed = $this->Form->value("Perms." . str_replace("/", ":", $action) . ".{$aroAlias}:{$aro[$aroAlias][$aroPk]}");

and line 33:

Form->select("Perms." . str_replace("/", ":", $action) . ".{$aroAlias}:{$aro[$aroAlias][$aroPk]}", array(array('inherit' => __('Inherit'), 'allow' => __('Allow'), 'deny' => __('Deny'))), array('empty' => __('No change'), 'value' => $value)); ?>
tranfuga25s commented 10 years ago

Also in AclController.php line 324 should take the $Model->primaryKey, if not it will create all ARO's with NULL foreign_key's:

$item = $item[$Model->alias]; $Model->create(); $Model->id = $item[$Model->primaryKey];

Should checkout also that the parent node has hardcoded primaryKey name.

FMCorz commented 10 years ago

Thanks. If you feel like submitting a Pull Request it would be much appreciated. Cheers, Fred

tranfuga25s commented 10 years ago

Any chance to get attention to the merge request?