From 2075687b042bd0cdb8eb8d729040769f87acb5ce Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Mon, 23 Oct 2023 11:39:06 +0200 Subject: [PATCH] chg: [event:restSearch] Added support of orgc_id as valid filter --- app/Model/Event.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Model/Event.php b/app/Model/Event.php index 90c608d29..d22dfdc38 100755 --- a/app/Model/Event.php +++ b/app/Model/Event.php @@ -186,6 +186,7 @@ class Event extends AppModel 'order', 'protected', 'published', + 'orgc_id', ); public $validate = array( @@ -1545,6 +1546,7 @@ class Event extends AppModel 'event_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), + 'orgc_id' => array('function' => 'set_filter_orgc_id', 'pop' => true), 'uuid' => array('function' => 'set_filter_uuid', 'pop' => true), 'published' => array('function' => 'set_filter_published', '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']) { $conditions['AND'][] = array('Event.published' => $options['published']); } + if ($options['orgc_id']) { + $conditions['AND'][] = array('Event.orgc_id' => $options['orgc_id']); + } if (!empty($options['includeRelatedTags'])) { $options['includeGranularCorrelations'] = 1; } @@ -2639,6 +2644,15 @@ class Event extends AppModel 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) { if (!empty($params['org'])) {