chg: [decaying] `includeFullModel` parameter support in the UI

pull/5032/head
mokaddem 2019-09-06 11:43:08 +02:00
parent 893dd617c8
commit 3f57d600d0
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
3 changed files with 16 additions and 3 deletions

View File

@ -47,7 +47,7 @@ class RestResponseComponent extends Component
Besides the parameters listed, other, format specific ones can be passed along (for example: requested_attributes and includeContext for the CSV export).
This API allows pagination via the page and limit parameters.",
'mandatory' => array('returnFormat'),
'optional' => array('page', 'limit', 'value' , 'type', 'category', 'org', 'tags', 'date', 'last', 'eventid', 'withAttachments', 'uuid', 'publish_timestamp', 'timestamp', 'enforceWarninglist', 'to_ids', 'deleted', 'includeEventUuid', 'includeEventTags', 'event_timestamp', 'threat_level_id', 'eventinfo', 'includeProposals', 'includeDecayScore', 'decayingModel', 'excludeDecayed'),
'optional' => array('page', 'limit', 'value' , 'type', 'category', 'org', 'tags', 'date', 'last', 'eventid', 'withAttachments', 'uuid', 'publish_timestamp', 'timestamp', 'enforceWarninglist', 'to_ids', 'deleted', 'includeEventUuid', 'includeEventTags', 'event_timestamp', 'threat_level_id', 'eventinfo', 'includeProposals', 'includeDecayScore', 'includeFullModel', 'decayingModel', 'excludeDecayed'),
'params' => array()
)
),
@ -919,6 +919,12 @@ class RestResponseComponent extends Component
'values' => array(1 => 'True', 0 => 'False' ),
'help' => 'Include tags of matching events in the response'
),
'includeFullModel' => array(
'input' => 'radio',
'type' => 'integer',
'values' => array(1 => 'True', 0 => 'False' ),
'help' => 'Include all model information of matching events in the response'
),
'includeProposals' => array(
'input' => 'radio',
'type' => 'integer',

View File

@ -490,7 +490,7 @@ class DecayingModelController extends AppController
'value' , 'type', 'category', 'org', 'tags', 'from', 'to', 'last', 'eventid', 'withAttachments', 'uuid', 'publish_timestamp',
'timestamp', 'enforceWarninglist', 'to_ids', 'deleted', 'includeEventUuid', 'event_timestamp', 'threat_level_id', 'includeEventTags',
'includeProposals', 'returnFormat', 'published', 'limit', 'page', 'requested_attributes', 'includeContext', 'headerless',
'includeWarninglistHits', 'attackGalaxy', 'object_relation', 'id', 'includeDecayScore', 'decayingModel', 'excludeDecayed', 'modelOverrides'
'includeWarninglistHits', 'attackGalaxy', 'object_relation', 'id', 'includeDecayScore', 'includeFullModel', 'decayingModel', 'excludeDecayed', 'modelOverrides'
);
$filterData = array(
'request' => $this->request,

View File

@ -530,7 +530,14 @@ class DecayingModel extends AppModel
}
$score = $this->getScore($attribute, $model, $user);
$decayed = $this->isDecayed($attribute, $model, $score);
$to_attach = array('score' => $score, 'decayed' => $decayed, 'DecayingModel' => array('id' => $model['DecayingModel']['id']));
$to_attach = array(
'score' => $score,
'decayed' => $decayed,
'DecayingModel' => array(
'id' => $model['DecayingModel']['id'],
'name' => $model['DecayingModel']['name']
)
);
if ($include_full_model) {
$to_attach['DecayingModel'] = $model['DecayingModel'];
}