Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cluster related bug fixes in UCM #285

Merged
merged 7 commits into from
Dec 13, 2019
4 changes: 3 additions & 1 deletion src/components/com_tjucm/site/controllers/itemform.json.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ public function saveFormData()

// If data is valid then save the data into DB
$response = $model->saveFieldsData($formData);

$msg = null;

if ($response && empty($section))
Expand All @@ -296,7 +297,8 @@ public function saveFormData()
$msg = ($response) ? Text::_("COM_TJUCM_ITEM_SAVED_SUCCESSFULLY") : Text::_("COM_TJUCM_FORM_SAVE_FAILED");
}

// Disable the draft mode of the item if full f)orm is submitted
// Disable the draft mode of the item if full form is submitted
$table->load($recordId);
pravinTek marked this conversation as resolved.
Show resolved Hide resolved
$table->draft = $draft;
$table->modified_date = Factory::getDate()->toSql();
$table->store();
Expand Down
24 changes: 24 additions & 0 deletions src/components/com_tjucm/site/views/itemform/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Component\ComponentHelper;

/**
* View to edit
Expand Down Expand Up @@ -115,6 +116,29 @@ public function display($tpl = null)
if ($this->id && !$clusterId)
{
$input->set('cluster_id', $this->item->cluster_id);
$clusterId = $this->item->cluster_id;
}

// Get com_cluster component status
if (ComponentHelper::getComponent('com_cluster', true)->enabled)
{
// Get com_subusers component status
$subUserExist = ComponentHelper::getComponent('com_subusers', true)->enabled;

// Check user have permission to edit record of assigned cluster
if ($subUserExist && !empty($clusterId) && !$user->authorise('core.manageall', 'com_cluster'))
{
JLoader::import("/components/com_subusers/includes/rbacl", JPATH_ADMINISTRATOR);

// Check user has permission for mentioned cluster
if (!RBACL::authorise($user->id, 'com_cluster', 'core.manage', $clusterId))
{
$app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'error');
$app->setHeader('status', 403, true);

return;
}
}
}

// Get a copy record id
Expand Down