mirror of https://github.com/MISP/MISP
fix: Invalid uuid used in the objectreferences add form
parent
63e934824c
commit
36f6c9685d
|
@ -46,7 +46,7 @@ class AppController extends Controller {
|
||||||
|
|
||||||
public $helpers = array('Utility');
|
public $helpers = array('Utility');
|
||||||
|
|
||||||
private $__queryVersion = '19';
|
private $__queryVersion = '20';
|
||||||
public $pyMispVersion = '2.4.80';
|
public $pyMispVersion = '2.4.80';
|
||||||
public $phpmin = '5.6.5';
|
public $phpmin = '5.6.5';
|
||||||
public $phprec = '7.0.16';
|
public $phprec = '7.0.16';
|
||||||
|
|
|
@ -53,7 +53,7 @@ class ObjectReferencesController extends AppController {
|
||||||
}
|
}
|
||||||
$referenced_type = 1;
|
$referenced_type = 1;
|
||||||
$target_object = $this->ObjectReference->Object->find('first', array(
|
$target_object = $this->ObjectReference->Object->find('first', array(
|
||||||
'conditions' => array('Object.uuid' => $this->request->data['ObjectReference']['object_uuid']),
|
'conditions' => array('Object.uuid' => $this->request->data['ObjectReference']['referenced_uuid']),
|
||||||
'recursive' => -1,
|
'recursive' => -1,
|
||||||
'fields' => array('Object.id', 'Object.uuid', 'Object.event_id')
|
'fields' => array('Object.id', 'Object.uuid', 'Object.event_id')
|
||||||
));
|
));
|
||||||
|
@ -64,8 +64,9 @@ class ObjectReferencesController extends AppController {
|
||||||
throw new NotFoundException('Invalid target. Target has to be within the same event.');
|
throw new NotFoundException('Invalid target. Target has to be within the same event.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
debug($this->request->data);
|
||||||
$target_attribute = $this->ObjectReference->Object->Attribute->find('first', array(
|
$target_attribute = $this->ObjectReference->Object->Attribute->find('first', array(
|
||||||
'conditions' => array('Attribute.uuid' => $this->request->data['ObjectReference']['uuid']),
|
'conditions' => array('Attribute.uuid' => $this->request->data['ObjectReference']['referenced_uuid']),
|
||||||
'recursive' => -1,
|
'recursive' => -1,
|
||||||
'fields' => array('Attribute.id', 'Attribute.uuid', 'Attribute.event_id')
|
'fields' => array('Attribute.id', 'Attribute.uuid', 'Attribute.event_id')
|
||||||
));
|
));
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<?php
|
<?php
|
||||||
echo $this->Form->input('uuid', array(
|
echo $this->Form->input('referenced_uuid', array(
|
||||||
'label' => 'Target UUID',
|
'label' => 'Target UUID',
|
||||||
'div' => false,
|
'div' => false,
|
||||||
'style' => 'width:320px;'
|
'style' => 'width:320px;'
|
||||||
|
|
|
@ -3146,8 +3146,8 @@ function objectReferenceInput() {
|
||||||
var types = ["Attribute", "Object"];
|
var types = ["Attribute", "Object"];
|
||||||
for (var type in types) {
|
for (var type in types) {
|
||||||
for (var k in targetEvent[types[type]]) {
|
for (var k in targetEvent[types[type]]) {
|
||||||
if (targetEvent[types[type]][k]['uuid'] == $('#ObjectReferenceUuid').val()) {
|
if (targetEvent[types[type]][k]['uuid'] == $('#ObjectReferenceReferencedUuid').val()) {
|
||||||
$('#targetSelect').val($('#ObjectReferenceUuid').val());
|
$('#targetSelect').val($('#ObjectReferenceReferencedUuid').val());
|
||||||
changeObjectReferenceSelectOption();
|
changeObjectReferenceSelectOption();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3167,7 +3167,7 @@ function objectReferenceCheckForCustomRelationship() {
|
||||||
function changeObjectReferenceSelectOption() {
|
function changeObjectReferenceSelectOption() {
|
||||||
var object = $('#targetSelect option:selected');
|
var object = $('#targetSelect option:selected');
|
||||||
var uuid = $(object).val();
|
var uuid = $(object).val();
|
||||||
$('#ObjectReferenceUuid').val(uuid);
|
$('#ObjectReferenceReferencedUuid').val(uuid);
|
||||||
var type = $(object).data('type');
|
var type = $(object).data('type');
|
||||||
if (type == "Attribute") {
|
if (type == "Attribute") {
|
||||||
$('#targetData').html("");
|
$('#targetData').html("");
|
||||||
|
|
Loading…
Reference in New Issue