mirror of https://github.com/MISP/MISP
fix: [eventReport:reprotFromEvent] Make sure filtering condition are not empty
parent
a7270cc7c8
commit
08986712e1
|
@ -336,6 +336,9 @@ class EventReportsController extends AppController
|
||||||
if ($this->request->is('post') || $this->request->is('put')) {
|
if ($this->request->is('post') || $this->request->is('put')) {
|
||||||
$filters = $this->EventReport->jsonDecode($this->data['EventReport']['filters']);
|
$filters = $this->EventReport->jsonDecode($this->data['EventReport']['filters']);
|
||||||
$options['conditions'] = $filters;
|
$options['conditions'] = $filters;
|
||||||
|
$options['conditions'] = array_filter($filters, function($v) {
|
||||||
|
return $v !== '';
|
||||||
|
});
|
||||||
$options['event_id'] = $eventId;
|
$options['event_id'] = $eventId;
|
||||||
App::uses('ReportFromEvent', 'EventReport');
|
App::uses('ReportFromEvent', 'EventReport');
|
||||||
$optionFields = array_keys((new ReportFromEvent())->acceptedOptions);
|
$optionFields = array_keys((new ReportFromEvent())->acceptedOptions);
|
||||||
|
|
|
@ -33,14 +33,15 @@
|
||||||
private function getAttributes()
|
private function getAttributes()
|
||||||
{
|
{
|
||||||
$filterConditions = $this->__eventModel->Attribute->buildFilterConditions($this->__user, $this->__options['conditions']);
|
$filterConditions = $this->__eventModel->Attribute->buildFilterConditions($this->__user, $this->__options['conditions']);
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
'includeWarninglistHits' => true,
|
'includeWarninglistHits' => true,
|
||||||
'includeSightings' => true,
|
'includeSightings' => true,
|
||||||
'includeCorrelations' => true,
|
'includeCorrelations' => true,
|
||||||
'conditions' => [
|
'conditions' => array_merge(
|
||||||
'Attribute.event_id' => $this->__options['event_id'],
|
['Attribute.event_id' => $this->__options['event_id']],
|
||||||
$filterConditions
|
$filterConditions
|
||||||
]
|
)
|
||||||
];
|
];
|
||||||
$this->attributes = $this->__eventModel->Attribute->fetchAttributes($this->__user, $options);
|
$this->attributes = $this->__eventModel->Attribute->fetchAttributes($this->__user, $options);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue