From 6ca09d5c9466639c7967abfbe404be48bf33a2e0 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 13 Jul 2022 11:25:18 -0400 Subject: [PATCH] Island: Use RepositoryService in ClearSimulationData resource --- .../cc/resources/clear_simulation_data.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/monkey/monkey_island/cc/resources/clear_simulation_data.py b/monkey/monkey_island/cc/resources/clear_simulation_data.py index fa85cac70..342fadd5f 100644 --- a/monkey/monkey_island/cc/resources/clear_simulation_data.py +++ b/monkey/monkey_island/cc/resources/clear_simulation_data.py @@ -2,24 +2,22 @@ from http import HTTPStatus from flask import make_response -from monkey_island.cc.repository.i_credentials_repository import ICredentialsRepository from monkey_island.cc.resources.AbstractResource import AbstractResource from monkey_island.cc.resources.request_authentication import jwt_required -from monkey_island.cc.services.database import Database +from monkey_island.cc.services import RepositoryService class ClearSimulationData(AbstractResource): urls = ["/api/clear-simulation-data"] - def __init__(self, credentials_repository: ICredentialsRepository): - self._credentials_repository = credentials_repository + def __init__(self, repository_service: RepositoryService): + self._repository_service = repository_service @jwt_required def post(self): """ Clear all data collected during the simulation """ - Database.reset_db(reset_config=False) - self._credentials_repository.remove_stolen_credentials() + self._repository_service.clear_simulation_data() return make_response({}, HTTPStatus.OK)