mirror of https://github.com/MISP/MISP
chg: [internal] Convert array to const
parent
db242d6901
commit
180fb627cc
|
@ -790,7 +790,7 @@ class AttributesController extends AppController
|
|||
}
|
||||
}
|
||||
if ($existingAttribute['Attribute']['object_id']) {
|
||||
$result = $this->Attribute->save($this->request->data, array('fieldList' => $this->Attribute->editableFields));
|
||||
$result = $this->Attribute->save($this->request->data, array('fieldList' => Attribute::EDITABLE_FIELDS));
|
||||
if ($result) {
|
||||
$this->Attribute->AttributeTag->handleAttributeTags($this->Auth->user(), $this->request->data['Attribute'], $attribute['Event']['id'], $capture=true);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,21 @@ class Attribute extends AppModel
|
|||
'distribution' => array('desc' => 'Describes who will have access to the attribute.')
|
||||
);
|
||||
|
||||
public $editableFields = array('timestamp', 'category', 'value', 'value1', 'value2', 'to_ids', 'comment', 'distribution', 'sharing_group_id', 'deleted', 'disable_correlation', 'first_seen', 'last_seen');
|
||||
const EDITABLE_FIELDS = [
|
||||
'timestamp',
|
||||
'category',
|
||||
'value',
|
||||
'value1',
|
||||
'value2',
|
||||
'to_ids',
|
||||
'comment',
|
||||
'distribution',
|
||||
'sharing_group_id',
|
||||
'deleted',
|
||||
'disable_correlation',
|
||||
'first_seen',
|
||||
'last_seen',
|
||||
];
|
||||
|
||||
public $distributionDescriptions = array(
|
||||
0 => array('desc' => 'This field determines the current distribution of the event', 'formdesc' => "This setting will only allow members of your organisation on this server to see it."),
|
||||
|
@ -3786,7 +3800,7 @@ class Attribute extends AppModel
|
|||
$attribute['distribution'] = 5;
|
||||
}
|
||||
}
|
||||
$fieldList = $this->editableFields;
|
||||
$fieldList = self::EDITABLE_FIELDS;
|
||||
if (empty($existingAttribute)) {
|
||||
$addableFieldList = array('event_id', 'type', 'uuid');
|
||||
$fieldList = array_merge($fieldList, $addableFieldList);
|
||||
|
|
|
@ -884,7 +884,7 @@ class MispObject extends AppModel
|
|||
$newAttribute['event_id'] = $object['Object']['event_id'];
|
||||
$newAttribute['object_id'] = $object['Object']['id'];
|
||||
$newAttribute['timestamp'] = $date->getTimestamp();
|
||||
$result = $this->Event->Attribute->save(array('Attribute' => $newAttribute), array('fieldList' => $this->Attribute->editableFields));
|
||||
$result = $this->Event->Attribute->save(array('Attribute' => $newAttribute), array('fieldList' => Attribute::EDITABLE_FIELDS));
|
||||
if ($result) {
|
||||
$this->Event->Attribute->AttributeTag->handleAttributeTags($user, $newAttribute, $newAttribute['event_id'], $capture=true);
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ class MispObject extends AppModel
|
|||
}
|
||||
foreach ($object['Attribute'] as $origKey => $originalAttribute) {
|
||||
$originalAttribute['deleted'] = 1;
|
||||
$this->Event->Attribute->save($originalAttribute, array('fieldList' => $this->Attribute->editableFields));
|
||||
$this->Event->Attribute->save($originalAttribute, array('fieldList' => Attribute::EDITABLE_FIELDS));
|
||||
}
|
||||
}
|
||||
} else { // we only add the new attribute
|
||||
|
|
Loading…
Reference in New Issue