From 19308234742316c3200797543e306963339ac12e Mon Sep 17 00:00:00 2001 From: iglocska Date: Fri, 20 Jul 2018 16:32:30 +0200 Subject: [PATCH] fix: [API] set attribute distribution if it isn't set in the capture attribute call - should have worked via the beforevalidate() but it didn't - ah well --- app/Model/Attribute.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Model/Attribute.php b/app/Model/Attribute.php index 6c209b254..d2dfabd83 100644 --- a/app/Model/Attribute.php +++ b/app/Model/Attribute.php @@ -3342,6 +3342,12 @@ class Attribute extends AppModel 'object_relation' ); $this->create(); + if (!isset($attribute['distribution'])) { + $attribute['distribution'] = Configure::read('MISP.default_attribute_distribution'); + if ($attribute['distribution'] == 'event') { + $attribute['distribution'] = 5; + } + } if (!$this->save($attribute, array('fieldList' => $fieldList))) { $attribute_short = (isset($attribute['category']) ? $attribute['category'] : 'N/A') . '/' . (isset($attribute['type']) ? $attribute['type'] : 'N/A') . ' ' . (isset($attribute['value']) ? $attribute['value'] : 'N/A'); $log->create();