mirror of https://github.com/MISP/MISP
fix: [UI] Galaxy cluster UI cleanup
parent
359d692ff0
commit
ed4cf8172a
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
|
||||
/**
|
||||
* @property GalaxyElement $GalaxyElement
|
||||
*/
|
||||
class GalaxyElementsController extends AppController
|
||||
{
|
||||
public $components = array('Session', 'RequestHandler');
|
||||
|
@ -16,8 +19,9 @@ class GalaxyElementsController extends AppController
|
|||
|
||||
public function index($clusterId)
|
||||
{
|
||||
$user = $this->_closeSession();
|
||||
$filters = $this->IndexFilter->harvestParameters(array('context', 'searchall'));
|
||||
$aclConditions = $this->GalaxyElement->buildClusterConditions($this->Auth->user(), $clusterId);
|
||||
$aclConditions = $this->GalaxyElement->buildClusterConditions($user, $clusterId);
|
||||
if (empty($filters['context'])) {
|
||||
$filters['context'] = 'all';
|
||||
}
|
||||
|
@ -44,18 +48,15 @@ class GalaxyElementsController extends AppController
|
|||
'context' => $filters['context'],
|
||||
'searchall' => isset($filters['searchall']) ? $filters['searchall'] : ''
|
||||
]));
|
||||
$cluster = $this->GalaxyElement->GalaxyCluster->fetchIfAuthorized($this->Auth->user(), $clusterId, array('edit', 'delete'), false, false);
|
||||
$cluster = $this->GalaxyElement->GalaxyCluster->fetchIfAuthorized($user, $clusterId, array('edit', 'delete'), false, false);
|
||||
$canModify = !empty($cluster['authorized']);
|
||||
$canModify = true;
|
||||
$this->set('canModify', $canModify);
|
||||
if ($filters['context'] == 'JSONView') {
|
||||
if ($filters['context'] === 'JSONView') {
|
||||
$expanded = $this->GalaxyElement->getExpandedJSONFromElements($elements);
|
||||
$this->set('JSONElements', $expanded);
|
||||
}
|
||||
if ($this->request->is('ajax')) {
|
||||
$this->layout = false;
|
||||
$this->render('ajax/index');
|
||||
}
|
||||
$this->layout = false;
|
||||
$this->render('ajax/index');
|
||||
}
|
||||
|
||||
public function delete($elementId)
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
App::uses('AppModel', 'Model');
|
||||
|
||||
/**
|
||||
* @property GalaxyCluster $GalaxyCluster
|
||||
*/
|
||||
class GalaxyElement extends AppModel
|
||||
{
|
||||
public $useTable = 'galaxy_elements';
|
||||
|
|
|
@ -40,13 +40,12 @@ $description = $this->Markdown->cleanup($cluster['GalaxyCluster']['description']
|
|||
$table_data = array();
|
||||
$table_data[] = array('key' => __('Cluster ID'), 'value' => $cluster['GalaxyCluster']['id']);
|
||||
$table_data[] = array('key' => __('Name'), 'value' => $cluster['GalaxyCluster']['value']);
|
||||
$table_data[] = array('key' => __('Parent Galaxy'), 'value' => $cluster['GalaxyCluster']['Galaxy']['name'] ? $cluster['GalaxyCluster']['Galaxy']['name'] : $cluster['GalaxyCluster']['Galaxy']['type']);
|
||||
$table_data[] = array('key' => __('Parent Galaxy'), 'value' => $cluster['GalaxyCluster']['Galaxy']['name'] ?: $cluster['GalaxyCluster']['Galaxy']['type']);
|
||||
$table_data[] = array('key' => __('Description'), 'value' => $description, 'value_class' => 'md');
|
||||
if (!$cluster['GalaxyCluster']['default']) {
|
||||
$table_data[] = [
|
||||
'key' => __('Published'),
|
||||
'boolean' => $cluster['GalaxyCluster']['published'],
|
||||
'class' => !$cluster['GalaxyCluster']['published'] ? 'background-red bold' : ''
|
||||
];
|
||||
}
|
||||
$table_data[] = array('key' => __('Default'), 'boolean' => $cluster['GalaxyCluster']['default'], 'class' => 'black');
|
||||
|
@ -105,7 +104,7 @@ if (!empty($extendedByHtml)) {
|
|||
<?php
|
||||
if (!empty(Configure::read('Plugin.CyCat_enable'))) {
|
||||
$titleHTML = __('CyCat Relationships');
|
||||
$titleHTML .= sprintf('<a href="%s" onclick="event.stopPropagation()" title="%s" target="_blank"><img src="%s" style="height: 2.5em"/></a>',
|
||||
$titleHTML .= sprintf('<a href="%s" onclick="event.stopPropagation()" title="%s" target="_blank"><img src="%s" style="height: 2.5em"></a>',
|
||||
'https://cycat.org/',
|
||||
__('CyCAT or the CYbersecurity Resource CATalogue aims at mapping and documenting, in a single formalism and catalogue all the available cybersecurity tools, rules, playbooks, processes and controls.'),
|
||||
$baseurl . '/img/CyCat.ico'
|
||||
|
|
|
@ -39,7 +39,7 @@ $indexOptions = array(
|
|||
'text' => __('Add JSON as cluster\'s elements'),
|
||||
'title' => __('The provided JSON will be converted into Galaxy Cluster Elements'),
|
||||
'fa-icon' => 'plus',
|
||||
'requirement' => $canModify && ($context === 'JSONView'),
|
||||
'requirement' => $canModify && $context === 'JSONView',
|
||||
),
|
||||
)
|
||||
),
|
||||
|
@ -74,7 +74,7 @@ $indexOptions = array(
|
|||
)
|
||||
);
|
||||
|
||||
if ($context == 'JSONView') {
|
||||
if ($context === 'JSONView') {
|
||||
$indexOptions['data']['fields'] = [];
|
||||
$indexOptions['data']['data'] = [];
|
||||
$indexOptions['data']['skip_pagination'] = true;
|
||||
|
@ -82,7 +82,7 @@ if ($context == 'JSONView') {
|
|||
}
|
||||
|
||||
echo $this->element('/genericElements/IndexTable/index_table', $indexOptions);
|
||||
if ($context == 'JSONView') {
|
||||
if ($context === 'JSONView') {
|
||||
echo sprintf('<div id="elementJSONDiv" class="well well-small">%s</div>', json_encode(h($JSONElements)));
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue