mirror of https://github.com/MISP/MISP
fixes bug 87 - on import of existing event: event info changed, tagged
private. Also fixes events tagged private when added using REST api.pull/61/head
parent
e20cbf3303
commit
311a09e2b0
|
@ -266,10 +266,6 @@ class EventsController extends AppController {
|
||||||
// LATER do this with $this->validator()->remove('event_id');
|
// LATER do this with $this->validator()->remove('event_id');
|
||||||
unset($this->Event->Attribute->validate['event_id']);
|
unset($this->Event->Attribute->validate['event_id']);
|
||||||
unset($this->Event->Attribute->validate['value']['unique']); // otherwise gives bugs because event_id is not set
|
unset($this->Event->Attribute->validate['value']['unique']); // otherwise gives bugs because event_id is not set
|
||||||
|
|
||||||
// thing a 'pull from server' sets ServersController.php:176
|
|
||||||
// Event.info is appended from the publishing side, given the need to have Server.url
|
|
||||||
$data['Event']['private'] = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['Event']['uuid'])) { // TODO here we should start RESTful dialog
|
if (isset($data['Event']['uuid'])) { // TODO here we should start RESTful dialog
|
||||||
|
|
|
@ -176,8 +176,13 @@ class ServersController extends AppController {
|
||||||
$this->Server->data);
|
$this->Server->data);
|
||||||
if (null != $event) {
|
if (null != $event) {
|
||||||
// we have an Event array
|
// we have an Event array
|
||||||
$event['Event']['private'] = true;
|
// check if the event already exist (using the uuid)
|
||||||
$event['Event']['info'] .= "\n Imported from " . $this->Server->data['Server']['url'];
|
$existingEventCount = $this->Event->find('count', array('conditions' => array('Event.uuid' => $event['Event']['uuid'])));
|
||||||
|
if ($existingEventCount == 0) {
|
||||||
|
// add data for newly imported events
|
||||||
|
$event['Event']['private'] = true;
|
||||||
|
$event['Event']['info'] .= "\n Imported from " . $this->Server->data['Server']['url'];
|
||||||
|
}
|
||||||
$eventsController = new EventsController();
|
$eventsController = new EventsController();
|
||||||
try {
|
try {
|
||||||
$result = $eventsController->_add($event, $this->Auth, $fromXml = true, $this->Server->data['Server']['organization']);
|
$result = $eventsController->_add($event, $this->Auth, $fromXml = true, $this->Server->data['Server']['organization']);
|
||||||
|
|
Loading…
Reference in New Issue