Skip to content

Commit

Permalink
Task techjoomla#14 chore: resolve MR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pravinTek committed Oct 14, 2019
1 parent b0ce829 commit ef93b1b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/components/com_cluster/site/controllers/clusterusers.json.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Session\Session;

Expand All @@ -34,14 +34,20 @@ class ClusterControllerClusterUsers extends BaseController
*/
public function getUsersByClientId()
{
$app = Factory::getApplication();

// Check for request forgeries.
Session::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
if (!Session::checkToken())
{
echo new JsonResponse(null, Text::_('JINVALID_TOKEN'), true);
$app->close();
}

$clusterIds = Factory::getApplication()->input->getInt('cluster_id', 0);
$clusterIds = $app->input->getInt('cluster_id', 0);
$userOptions = $allUsers = array();

// Initialize array to store dropdown options
$userOptions[] = HTMLHelper::_('select.option', "", Text::_('COM_TJFIELDS_OWNERSHIP_USER'));
$userOptions[] = HTMLHelper::_('select.option', "", Text::_('COM_CLUSTER_OWNERSHIP_USER'));

// Check cluster selected or not
if ($clusterIds)
Expand All @@ -61,7 +67,7 @@ public function getUsersByClientId()
}
}

echo new JResponseJson($userOptions);
jexit();
echo new JsonResponse($userOptions);
$app->close();
}
}

0 comments on commit ef93b1b

Please sign in to comment.