My controller is being passed a param twice due to the regexp I'm
using for 'perm'. I'd like to avoid using [a-z]+ although it's not
crucial. It just seems like better practice and, anyway, I'm curious.
I know I've seen this before but can't dig up the answer. Is is
possible?
Also, does anyone know why Cake behaves this way?
route.php:
Router::connect(
'/admin/groups/volume_permissions/:perm/:aro_id/:aco_id',
array(
'controller' => 'groups',
'action' => 'set_volume_permissions',
'admin' => 1
),
array(
'perm' => '(deny|allow)',
'aro_id' => '[0-9]+',
'aco_id' => '[0-9]+',
'pass' => array('perm', 'aro_id', 'aco_id')
)
);
view:
echo $html->link(
$data['Volume']['name'],
array(
'controller' => 'groups',
'action' => 'set_volume_permissions',
'perm' => ($data['Permission']['_read'] == 1 ? 'deny' :
'allow'),
'aro_id' => $aro['Aro']['id'],
'aco_id' => $data['Aco']['id'],
'admin' => 1
),
array('title' => 'change permissions')
);
controller:
public function admin_set_volume_permissions($permission = 'deny',
$aro_id = null, $aco_id = null)
{
debug($this->params);
result:
Array
(
[pass] => Array
(
[0] => deny
[1] => deny
[2] => 8
[3] => 3
)
[named] => Array
(
)
[perm] => deny
[aro_id] => deny
[aco_id] => 8
[plugin] =>
[controller] => groups
[action] => admin_set_volume_permissions
[admin] => 1
[prefix] => admin
[form] => Array
(
)
[url] => Array
(
[url] => admin/groups/volume_permissions/deny/8/3
)
)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---