diff --git a/monkey/monkey_island/cc/models/zero_trust/finding.py b/monkey/monkey_island/cc/models/zero_trust/finding.py index 4d108ddde..2e6b9c172 100644 --- a/monkey/monkey_island/cc/models/zero_trust/finding.py +++ b/monkey/monkey_island/cc/models/zero_trust/finding.py @@ -5,8 +5,6 @@ Define a Document Schema for Zero Trust findings. from __future__ import annotations -import abc - from mongoengine import Document, GenericLazyReferenceField, StringField import common.common_consts.zero_trust_consts as zero_trust_consts @@ -45,9 +43,11 @@ class Finding(Document): details = GenericLazyReferenceField(required=True) # Creation methods - @staticmethod - @abc.abstractmethod - def save_finding(test: str, + @classmethod + def save_finding(cls, + test: str, status: str, detail_ref) -> Finding: - pass + finding = cls(test=test, status=status, details=detail_ref) + finding.save() + return finding diff --git a/monkey/monkey_island/cc/models/zero_trust/monkey_finding.py b/monkey/monkey_island/cc/models/zero_trust/monkey_finding.py index e063ea5c1..1de81303c 100644 --- a/monkey/monkey_island/cc/models/zero_trust/monkey_finding.py +++ b/monkey/monkey_island/cc/models/zero_trust/monkey_finding.py @@ -6,13 +6,3 @@ from monkey_island.cc.models.zero_trust.monkey_finding_details import MonkeyFind class MonkeyFinding(Finding): details = LazyReferenceField(MonkeyFindingDetails, required=True) - - @staticmethod - def save_finding(test: str, - status: str, - detail_ref: MonkeyFindingDetails) -> Finding: - monkey_finding = MonkeyFinding(test=test, - status=status, - details=detail_ref) - monkey_finding.save() - return monkey_finding diff --git a/monkey/monkey_island/cc/models/zero_trust/scoutsuite_finding.py b/monkey/monkey_island/cc/models/zero_trust/scoutsuite_finding.py index 8adeef2e9..dd323a73c 100644 --- a/monkey/monkey_island/cc/models/zero_trust/scoutsuite_finding.py +++ b/monkey/monkey_island/cc/models/zero_trust/scoutsuite_finding.py @@ -6,13 +6,3 @@ from monkey_island.cc.models.zero_trust.scoutsuite_finding_details import ScoutS class ScoutSuiteFinding(Finding): details = LazyReferenceField(ScoutSuiteFindingDetails, required=True) - - @staticmethod - def save_finding(test: str, - status: str, - detail_ref: ScoutSuiteFindingDetails) -> Finding: - scoutsuite_finding = ScoutSuiteFinding(test=test, - status=status, - details=detail_ref) - scoutsuite_finding.save() - return scoutsuite_finding