Skip to content

Commit bf7342d

Browse files
committed
[client] Implement organization seggregation at creation for individual / systems (#712)
1 parent 5bd47f1 commit bf7342d

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

pycti/entities/opencti_identity.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ def __init__(self, opencti):
6060
x_opencti_order
6161
x_opencti_color
6262
}
63+
objectOrganization {
64+
id
65+
standard_id
66+
name
67+
}
6368
objectLabel {
6469
id
6570
value
@@ -148,6 +153,11 @@ def __init__(self, opencti):
148153
x_opencti_order
149154
x_opencti_color
150155
}
156+
objectOrganization {
157+
id
158+
standard_id
159+
name
160+
}
151161
objectLabel {
152162
id
153163
value
@@ -388,6 +398,7 @@ def create(self, **kwargs):
388398
x_opencti_firstname = kwargs.get("x_opencti_firstname", None)
389399
x_opencti_lastname = kwargs.get("x_opencti_lastname", None)
390400
x_opencti_stix_ids = kwargs.get("x_opencti_stix_ids", None)
401+
granted_refs = kwargs.get("objectOrganization", None)
391402
x_opencti_workflow_id = kwargs.get("x_opencti_workflow_id", None)
392403
update = kwargs.get("update", False)
393404

@@ -440,6 +451,7 @@ def create(self, **kwargs):
440451
}
441452
}
442453
"""
454+
input_variables["objectOrganization"] = granted_refs
443455
input_variables["x_opencti_firstname"] = x_opencti_firstname
444456
input_variables["x_opencti_lastname"] = x_opencti_lastname
445457
input_variables["x_opencti_reliability"] = x_opencti_reliability
@@ -455,6 +467,7 @@ def create(self, **kwargs):
455467
}
456468
}
457469
"""
470+
input_variables["objectOrganization"] = granted_refs
458471
input_variables["x_opencti_firstname"] = x_opencti_firstname
459472
input_variables["x_opencti_lastname"] = x_opencti_lastname
460473
input_variables["x_opencti_reliability"] = x_opencti_reliability
@@ -470,6 +483,7 @@ def create(self, **kwargs):
470483
}
471484
}
472485
"""
486+
input_variables["objectOrganization"] = granted_refs
473487
input_variables["type"] = type
474488
result_data_field = "identityAdd"
475489
result = self.opencti.query(
@@ -540,6 +554,10 @@ def import_from_stix2(self, **kwargs):
540554
stix_object["x_opencti_stix_ids"] = (
541555
self.opencti.get_attribute_in_extension("stix_ids", stix_object)
542556
)
557+
if "x_opencti_granted_refs" not in stix_object:
558+
stix_object["x_opencti_granted_refs"] = (
559+
self.opencti.get_attribute_in_extension("granted_refs", stix_object)
560+
)
543561
if "x_opencti_workflow_id" not in stix_object:
544562
stix_object["x_opencti_workflow_id"] = (
545563
self.opencti.get_attribute_in_extension("workflow_id", stix_object)
@@ -611,6 +629,11 @@ def import_from_stix2(self, **kwargs):
611629
if "x_opencti_stix_ids" in stix_object
612630
else None
613631
),
632+
objectOrganization=(
633+
stix_object["x_opencti_granted_refs"]
634+
if "x_opencti_granted_refs" in stix_object
635+
else None
636+
),
614637
x_opencti_workflow_id=(
615638
stix_object["x_opencti_workflow_id"]
616639
if "x_opencti_workflow_id" in stix_object

pycti/entities/opencti_location.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ def __init__(self, opencti):
5858
x_opencti_order
5959
x_opencti_color
6060
}
61+
objectOrganization {
62+
id
63+
standard_id
64+
name
65+
}
6166
objectLabel {
6267
id
6368
value
@@ -139,6 +144,11 @@ def __init__(self, opencti):
139144
x_opencti_order
140145
x_opencti_color
141146
}
147+
objectOrganization {
148+
id
149+
standard_id
150+
name
151+
}
142152
objectLabel {
143153
id
144154
value

0 commit comments

Comments
 (0)