mirror of https://github.com/MISP/MISP
chg: [event:restSearch] Added support of orgc_id as valid filter
parent
2a23c1d234
commit
2075687b04
|
@ -186,6 +186,7 @@ class Event extends AppModel
|
||||||
'order',
|
'order',
|
||||||
'protected',
|
'protected',
|
||||||
'published',
|
'published',
|
||||||
|
'orgc_id',
|
||||||
);
|
);
|
||||||
|
|
||||||
public $validate = array(
|
public $validate = array(
|
||||||
|
@ -1545,6 +1546,7 @@ class Event extends AppModel
|
||||||
'event_timestamp' => array('function' => 'set_filter_timestamp', 'pop' => true),
|
'event_timestamp' => array('function' => 'set_filter_timestamp', 'pop' => true),
|
||||||
'publish_timestamp' => array('function' => 'set_filter_timestamp', 'pop' => true),
|
'publish_timestamp' => array('function' => 'set_filter_timestamp', 'pop' => true),
|
||||||
'org' => array('function' => 'set_filter_org', 'pop' => true),
|
'org' => array('function' => 'set_filter_org', 'pop' => true),
|
||||||
|
'orgc_id' => array('function' => 'set_filter_orgc_id', 'pop' => true),
|
||||||
'uuid' => array('function' => 'set_filter_uuid', 'pop' => true),
|
'uuid' => array('function' => 'set_filter_uuid', 'pop' => true),
|
||||||
'published' => array('function' => 'set_filter_published', 'pop' => true),
|
'published' => array('function' => 'set_filter_published', 'pop' => true),
|
||||||
'threat_level_id' => array('function' => 'set_filter_threat_level_id', 'pop' => true),
|
'threat_level_id' => array('function' => 'set_filter_threat_level_id', 'pop' => true),
|
||||||
|
@ -1905,6 +1907,9 @@ class Event extends AppModel
|
||||||
if ($options['published']) {
|
if ($options['published']) {
|
||||||
$conditions['AND'][] = array('Event.published' => $options['published']);
|
$conditions['AND'][] = array('Event.published' => $options['published']);
|
||||||
}
|
}
|
||||||
|
if ($options['orgc_id']) {
|
||||||
|
$conditions['AND'][] = array('Event.orgc_id' => $options['orgc_id']);
|
||||||
|
}
|
||||||
if (!empty($options['includeRelatedTags'])) {
|
if (!empty($options['includeRelatedTags'])) {
|
||||||
$options['includeGranularCorrelations'] = 1;
|
$options['includeGranularCorrelations'] = 1;
|
||||||
}
|
}
|
||||||
|
@ -2639,6 +2644,15 @@ class Event extends AppModel
|
||||||
return $conditions;
|
return $conditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function set_filter_orgc_id(&$params, $conditions, $options)
|
||||||
|
{
|
||||||
|
if (!empty($params['orgc_id'])) {
|
||||||
|
$orgFilter = ['OR' => $params['orgc_id']];
|
||||||
|
$conditions = $this->generic_add_filter($conditions, $orgFilter, 'Event.orgc_id');
|
||||||
|
}
|
||||||
|
return $conditions;
|
||||||
|
}
|
||||||
|
|
||||||
public function set_filter_org(&$params, $conditions, $options)
|
public function set_filter_org(&$params, $conditions, $options)
|
||||||
{
|
{
|
||||||
if (!empty($params['org'])) {
|
if (!empty($params['org'])) {
|
||||||
|
|
Loading…
Reference in New Issue