@@ -2646,11 +2646,25 @@ def element_remove_groups(self, item):
26462646 {"type" : item ["type" ]},
26472647 )
26482648
2649+ def send_email (self , item ):
2650+ template_id = self .opencti .get_attribute_in_extension ("template_id" , item )
2651+ if template_id is None :
2652+ template_id = item ["template_id" ]
2653+ if item ["type" ] == "user" :
2654+ self .opencti .user .send_mail (id = item ["id" ], template_id = template_id [0 ])
2655+ else :
2656+ raise ValueError (
2657+ "Not supported opencti_operation for this type" ,
2658+ {"type" : item ["type" ]},
2659+ )
2660+
26492661 def element_operation_delete (self , item , operation ):
26502662 # If data is stix, just use the generic stix function for deletion
26512663 force_delete = operation == "delete_force"
26522664 if item ["type" ] == "relationship" :
26532665 self .opencti .stix_core_relationship .delete (id = item ["id" ])
2666+ elif item ["type" ] == "external-reference" :
2667+ self .opencti .external_reference .delete (item ["id" ])
26542668 elif item ["type" ] == "sighting" :
26552669 self .opencti .stix_sighting_relationship .delete (id = item ["id" ])
26562670 elif item ["type" ] in STIX_META_OBJECTS :
@@ -2736,6 +2750,8 @@ def apply_opencti_operation(self, item, operation):
27362750 self .element_add_groups (item )
27372751 elif operation == "remove_groups" :
27382752 self .element_remove_groups (item )
2753+ elif operation == "send_email" :
2754+ self .send_email (item = item )
27392755 else :
27402756 raise ValueError (
27412757 "Not supported opencti_operation" ,
0 commit comments