Skip to content

Commit

Permalink
Another fix for submission ACL check, don't check if not record_in_da…
Browse files Browse the repository at this point in the history
…tabase ('cos doesn't have a list / list ACLs)
  • Loading branch information
cheesegrits committed Nov 3, 2016
1 parent 76c0176 commit 0b4b877
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
37 changes: 22 additions & 15 deletions components/com_fabrik/controllers/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,23 +215,30 @@ public function process()
*
* Used to setFormData() in the model validate(), but need to get it here so we can pass it to canEdit()
*/
$formData = $model->setFormData();
$aclOK = false;

if ($model->isNewRecord() && $listModel->canAdd())
{
$aclOK = true;
}
else if (!$model->isNewRecord() && $listModel->canEdit($formData))
if ($model->recordInDatabase())
{
$aclOK = true;
}
$formData = $model->setFormData();
$aclOK = false;

if (!$aclOK)
{
$msg = $model->aclMessage(true);
$app->enqueueMessage($msg);
return;
if ($model->isNewRecord() && $listModel->canAdd())
{
$aclOK = true;
}
else
{
if (!$model->isNewRecord() && $listModel->canEdit($formData))
{
$aclOK = true;
}
}

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

return;
}
}

/**
Expand Down
7 changes: 7 additions & 0 deletions components/com_fabrik/models/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -5366,4 +5366,11 @@ public function getLayout($name, $paths = array(), $options = array())

return $layout;
}

public function recordInDatabase()
{
$form = $this->getForm();

return $form->record_in_database === '1';
}
}

0 comments on commit 0b4b877

Please sign in to comment.