Island: Use RepositoryService in ClearSimulationData resource

This commit is contained in:
Mike Salvatore 2022-07-13 11:25:18 -04:00
parent fcff724eaa
commit 6ca09d5c94
1 changed files with 4 additions and 6 deletions

View File

@ -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)