
Untitled
By: a guest on
Apr 24th, 2012 | syntax:
None | size: 0.56 KB | hits: 12 | expires: Never
cakephp ACL permissions inside loops
foreach($users as $user)
{
// check if user has permission to execute action
$is_allowed = $this->Acl->check(
array('model'=>'User', 'foreign_key'=>$the_user_id),
'controllers/MyController/action_to_be_executed');
if(!$is_allowed)
{
// give permission to user
$this->Acl->allow(
array('model'=>'User', 'foreign_key'=>$the_user_id),
'controllers/MyController/action_to_be_executed');
}
}
$this->Auth->allow('action_to_be_executed');