mirror of https://github.com/MISP/MISP
chg: [internal] Threat levels list
parent
e716df5259
commit
3935dee16b
|
@ -590,13 +590,7 @@ class EventsController extends AppController
|
||||||
$searchTermInternal = $searchTerm;
|
$searchTermInternal = $searchTerm;
|
||||||
if ($searchTerm == 'threatlevel') {
|
if ($searchTerm == 'threatlevel') {
|
||||||
$searchTermInternal = 'threat_level_id';
|
$searchTermInternal = 'threat_level_id';
|
||||||
$threatLevels = $this->Event->ThreatLevel->find('all', array(
|
$terms = $this->Event->ThreatLevel->list();
|
||||||
'recursive' => -1,
|
|
||||||
'fields' => array('id', 'name'),
|
|
||||||
));
|
|
||||||
foreach ($threatLevels as $tl) {
|
|
||||||
$terms[$tl['ThreatLevel']['id']] = $tl['ThreatLevel']['name'];
|
|
||||||
}
|
|
||||||
} elseif ($searchTerm == 'analysis') {
|
} elseif ($searchTerm == 'analysis') {
|
||||||
$terms = $this->Event->analysisLevels;
|
$terms = $this->Event->analysisLevels;
|
||||||
} else {
|
} else {
|
||||||
|
@ -4765,8 +4759,7 @@ class EventsController extends AppController
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->set('events', $this->paginate());
|
$this->set('events', $this->paginate());
|
||||||
$threat_levels = $this->Event->ThreatLevel->find('all');
|
$this->set('threatLevels', $this->Event->ThreatLevel->list());
|
||||||
$this->set('threatLevels', Set::combine($threat_levels, '{n}.ThreatLevel.id', '{n}.ThreatLevel.name'));
|
|
||||||
$this->set('eventDescriptions', $this->Event->fieldDescriptions);
|
$this->set('eventDescriptions', $this->Event->fieldDescriptions);
|
||||||
$this->set('analysisLevels', $this->Event->analysisLevels);
|
$this->set('analysisLevels', $this->Event->analysisLevels);
|
||||||
$this->set('distributionLevels', $this->Event->distributionLevels);
|
$this->set('distributionLevels', $this->Event->distributionLevels);
|
||||||
|
|
|
@ -690,8 +690,7 @@ class FeedsController extends AppController
|
||||||
}
|
}
|
||||||
$this->set('events', $events);
|
$this->set('events', $events);
|
||||||
$this->loadModel('Event');
|
$this->loadModel('Event');
|
||||||
$threat_levels = $this->Event->ThreatLevel->find('all');
|
$this->set('threatLevels', $this->Event->ThreatLevel->list());
|
||||||
$this->set('threatLevels', Set::combine($threat_levels, '{n}.ThreatLevel.id', '{n}.ThreatLevel.name'));
|
|
||||||
$this->set('eventDescriptions', $this->Event->fieldDescriptions);
|
$this->set('eventDescriptions', $this->Event->fieldDescriptions);
|
||||||
$this->set('analysisLevels', $this->Event->analysisLevels);
|
$this->set('analysisLevels', $this->Event->analysisLevels);
|
||||||
$this->set('distributionLevels', $this->Event->distributionLevels);
|
$this->set('distributionLevels', $this->Event->distributionLevels);
|
||||||
|
@ -798,8 +797,7 @@ class FeedsController extends AppController
|
||||||
$this->set($alias, $currentModel->{$variable});
|
$this->set($alias, $currentModel->{$variable});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$threat_levels = $this->Event->ThreatLevel->find('all');
|
$this->set('threatLevels', $this->Event->ThreatLevel->list());
|
||||||
$this->set('threatLevels', Set::combine($threat_levels, '{n}.ThreatLevel.id', '{n}.ThreatLevel.name'));
|
|
||||||
} else {
|
} else {
|
||||||
if ($event === 'blocked') {
|
if ($event === 'blocked') {
|
||||||
throw new MethodNotAllowedException(__('This event is blocked by the Feed filters.'));
|
throw new MethodNotAllowedException(__('This event is blocked by the Feed filters.'));
|
||||||
|
|
|
@ -124,8 +124,7 @@ class ServersController extends AppController
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->loadModel('Event');
|
$this->loadModel('Event');
|
||||||
$threat_levels = $this->Event->ThreatLevel->find('list', ['fields' => ['id', 'name']]);
|
$this->set('threatLevels', $this->Event->ThreatLevel->list());
|
||||||
$this->set('threatLevels', $threat_levels);
|
|
||||||
App::uses('CustomPaginationTool', 'Tools');
|
App::uses('CustomPaginationTool', 'Tools');
|
||||||
$customPagination = new CustomPaginationTool();
|
$customPagination = new CustomPaginationTool();
|
||||||
$params = $customPagination->createPaginationRules($events, $this->passedArgs, $this->alias);
|
$params = $customPagination->createPaginationRules($events, $this->passedArgs, $this->alias);
|
||||||
|
@ -202,8 +201,7 @@ class ServersController extends AppController
|
||||||
$this->set($alias, $currentModel->{$variable});
|
$this->set($alias, $currentModel->{$variable});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$threat_levels = $this->Event->ThreatLevel->find('list', ['fields' => ['id', 'name']]);
|
$this->set('threatLevels', $this->Event->ThreatLevel->list());
|
||||||
$this->set('threatLevels', $threat_levels);
|
|
||||||
$this->set('title_for_layout', __('Remote event preview'));
|
$this->set('title_for_layout', __('Remote event preview'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,4 +22,11 @@ class ThreatLevel extends AppModel
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public function list()
|
||||||
|
{
|
||||||
|
return $this->find('list', [
|
||||||
|
'fields' => ['id', 'name'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue