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
pull/3510/head
iglocska 2018-07-20 16:32:30 +02:00
parent b99adf5d76
commit 1930823474
1 changed files with 6 additions and 0 deletions

View File

@ -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();