Skip to content

Commit

Permalink
Merge pull request #285 from pravinTek/latestVersion
Browse files Browse the repository at this point in the history
Cluster related bug fixes in UCM
  • Loading branch information
ankush-maherwal authored Dec 13, 2019
2 parents 7cdd71c + b813844 commit 703b821
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
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);
$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

0 comments on commit 703b821

Please sign in to comment.