changed source => object / destination => referenced

pull/111/head
iglocska 2017-09-07 16:09:45 +02:00
parent 2a5f3346e4
commit b337e77070
1 changed files with 7 additions and 7 deletions

View File

@ -638,13 +638,13 @@ class MISPEvent(object):
class MISPObjectReference(AbstractMISP): class MISPObjectReference(AbstractMISP):
attributes = ['source_uuid', 'referenced_uuid', 'relationship_type', 'comment', 'uuid', 'deleted'] attributes = ['object_uuid', 'referenced_uuid', 'relationship_type', 'comment', 'uuid', 'deleted']
def __init__(self): def __init__(self):
super(MISPObjectReference, self).__init__() super(MISPObjectReference, self).__init__()
def from_dict(self, source_uuid, referenced_uuid, relationship_type, comment=None, **kwargs): def from_dict(self, object_uuid, referenced_uuid, relationship_type, comment=None, **kwargs):
self.source_uuid = source_uuid self.object_uuid = object_uuid
self.referenced_uuid = referenced_uuid self.referenced_uuid = referenced_uuid
self.relationship_type = relationship_type self.relationship_type = relationship_type
self.comment = comment self.comment = comment
@ -774,14 +774,14 @@ class MISPObject(AbstractMISP):
def add_reference(self, referenced_uuid, relationship_type, comment=None, **kwargs): def add_reference(self, referenced_uuid, relationship_type, comment=None, **kwargs):
"""Add a link (uuid) to an other object""" """Add a link (uuid) to an other object"""
if kwargs.get('source_uuid'): if kwargs.get('object_uuid'):
# Load existing object # Load existing object
source_uuid = kwargs.get('source_uuid') object_uuid = kwargs.get('object_uuid')
else: else:
# New reference # New reference
source_uuid = self.uuid object_uuid = self.uuid
reference = MISPObjectReference() reference = MISPObjectReference()
reference.from_dict(source_uuid=source_uuid, referenced_uuid=referenced_uuid, reference.from_dict(object_uuid=object_uuid, referenced_uuid=referenced_uuid,
relationship_type=relationship_type, comment=comment, **kwargs) relationship_type=relationship_type, comment=comment, **kwargs)
self.ObjectReference.append(reference) self.ObjectReference.append(reference)