Skip to content

Commit

Permalink
Added some belt and braces ACL checks on form submission (corner case…
Browse files Browse the repository at this point in the history
… if spoof checking disabled)
  • Loading branch information
cheesegrits committed Oct 28, 2016
1 parent a321889 commit 9201e79
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
27 changes: 24 additions & 3 deletions components/com_fabrik/controllers/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function process()
$profiler = JProfiler::getInstance('Application');
JDEBUG ? $profiler->mark('controller process: start') : null;

$app = JFactory::getApplication();
$app = JFactory::getApplication();
$input = $app->input;

if ($input->get('format', '') == 'raw')
Expand All @@ -204,8 +204,29 @@ public function process()

$model->setId($input->getInt('formid', 0));
$model->packageId = $input->getInt('packageId');
$this->isMambot = $input->get('isMambot', 0);
$model->rowId = $input->get('rowid', '', 'string');
$this->isMambot = $input->get('isMambot', 0);
$model->rowId = $input->get('rowid', '', 'string');
$listModel = $model->getListModel();

// Do some ACL sanity checks

$aclOK = false;

if ($model->isNewRecord() && $listModel->canAdd())
{
$aclOK = true;
}
else if (!$model->isNewRecord() && $listModel->canEdit(new stdClass()))
{
$aclOK = true;
}

if (!$aclOK)
{
$msg = $model->aclMessage(true);
$app->enqueueMessage($msg);
return;
}

/**
* $$$ hugh - need this in plugin manager to be able to treat a "Copy" form submission
Expand Down
6 changes: 4 additions & 2 deletions components/com_fabrik/models/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -5139,13 +5139,15 @@ public function showACLMsg()
* If trying to add/edit a record when the user doesn't have rights to do so,
* what message, if any should we show.
*
* @param bool $force if true don't check if messages suppressed
*
* @since 3.0.7
*
* @return string
*/
public function aclMessage()
public function aclMessage($force = false)
{
if (!$this->showACLMsg())
if (!$force && !$this->showACLMsg())
{
return '';
}
Expand Down

0 comments on commit 9201e79

Please sign in to comment.