@@ -1692,7 +1692,9 @@ def rule_apply(self, **kwargs):
16921692 rule_id = kwargs .get ("rule_id" , None )
16931693 element_id = kwargs .get ("element_id" , None )
16941694 if element_id is not None and rule_id is not None :
1695- self .opencti .app_logger .info ("Apply rule stix_core_object" , {"id" : element_id })
1695+ self .opencti .app_logger .info (
1696+ "Apply rule stix_core_object" , {"id" : element_id }
1697+ )
16961698 query = """
16971699 mutation StixCoreApplyRule($elementId: ID!, $ruleId: ID!) {
16981700 ruleApply(elementId: $elementId, ruleId: $ruleId)
@@ -1715,7 +1717,9 @@ def rule_clear(self, **kwargs):
17151717 rule_id = kwargs .get ("rule_id" , None )
17161718 element_id = kwargs .get ("element_id" , None )
17171719 if element_id is not None and rule_id is not None :
1718- self .opencti .app_logger .info ("Apply rule clear stix_core_object" , {"id" : element_id })
1720+ self .opencti .app_logger .info (
1721+ "Apply rule clear stix_core_object" , {"id" : element_id }
1722+ )
17191723 query = """
17201724 mutation StixCoreClearRule($elementId: ID!, $ruleId: ID!) {
17211725 ruleClear(elementId: $elementId, ruleId: $ruleId)
@@ -1726,6 +1730,81 @@ def rule_clear(self, **kwargs):
17261730 self .opencti .app_logger .error ("[stix_core_object] Missing parameters: id" )
17271731 return None
17281732
1733+ """
1734+ Apply rules rescan to Stix-Core-Object object
1735+
1736+ :param element_id: the Stix-Core-Object id
1737+ :return void
1738+ """
1739+
1740+ def rules_rescan (self , ** kwargs ):
1741+ element_id = kwargs .get ("element_id" , None )
1742+ if element_id is not None :
1743+ self .opencti .app_logger .info (
1744+ "Apply rules rescan stix_core_object" , {"id" : element_id }
1745+ )
1746+ query = """
1747+ mutation StixCoreRescanRules($elementId: ID!) {
1748+ rulesRescan(elementId: $elementId)
1749+ }
1750+ """
1751+ self .opencti .query (query , {"elementId" : element_id })
1752+ else :
1753+ self .opencti .app_logger .error ("[stix_core_object] Missing parameters: id" )
1754+ return None
1755+
1756+ """
1757+ Share element to multiple organizations
1758+
1759+ :param entity_id: the Stix-Core-Object id
1760+ :param organization_id:s the organization to share with
1761+ :return void
1762+ """
1763+
1764+ def organization_share (self , entity_id , organization_ids ):
1765+ query = """
1766+ mutation StixCoreObjectEdit($id: ID!, $organizationId: [ID!]!) {
1767+ stixCoreObjectEdit(id: $id) {
1768+ restrictionOrganizationAdd(organizationId: $organizationId) {
1769+ id
1770+ }
1771+ }
1772+ }
1773+ """
1774+ self .opencti .query (
1775+ query ,
1776+ {
1777+ "id" : entity_id ,
1778+ "organizationId" : organization_ids ,
1779+ },
1780+ )
1781+
1782+ """
1783+ Unshare element from multiple organizations
1784+
1785+ :param entity_id: the Stix-Core-Object id
1786+ :param organization_id:s the organization to share with
1787+ :return void
1788+ """
1789+
1790+ def organization_unshare (self , entity_id , organization_ids ):
1791+ query = """
1792+ mutation StixCoreObjectEdit($id: ID!, $organizationId: [ID!]!) {
1793+ stixCoreObjectEdit(id: $id) {
1794+ restrictionOrganizationDelete(organizationId: $organizationId) {
1795+ id
1796+ }
1797+ }
1798+ }
1799+ """
1800+ self .opencti .query (
1801+ query ,
1802+ {
1803+ "id" : entity_id ,
1804+ "organizationId" : organization_ids ,
1805+ },
1806+ )
1807+
17291808 """
17301809 Delete a Stix-Core-Object object
17311810
0 commit comments