Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #695 from njam/issue-695
Browse files Browse the repository at this point in the history
smarty_function_actionAllowed: Pass arguments to isAllowed
  • Loading branch information
njam committed Jul 16, 2013
2 parents 9c9cec3 + 68c4e95 commit 4130236
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions library/CM/SmartyPlugins/function.actionAllowed.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ function smarty_function_actionAllowed(array $params, Smarty_Internal_Template $
if (!isset($params['verb'])) {
trigger_error('Param `verb` missing.');
}
if (!empty($params['forceAllow'])) {
return true;
}

$arguments = isset($params['arguments']) ? (array) $params['arguments'] : array();

/** @var CM_Model_User $viewer */
$viewer = $template->smarty->getTemplateVars('viewer');
Expand All @@ -24,5 +23,5 @@ function smarty_function_actionAllowed(array $params, Smarty_Internal_Template $

$action = CM_Action_Abstract::factory($viewer, (int) $params['verb'], (int) $params['type']);

return $action->isAllowed();
return call_user_func_array(array($action, 'isAllowed'), $arguments);
}

0 comments on commit 4130236

Please sign in to comment.