forked from p34709852/monkey
Island: Use RepositoryService in ClearSimulationData resource
This commit is contained in:
parent
fcff724eaa
commit
6ca09d5c94
|
@ -2,24 +2,22 @@ from http import HTTPStatus
|
||||||
|
|
||||||
from flask import make_response
|
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.AbstractResource import AbstractResource
|
||||||
from monkey_island.cc.resources.request_authentication import jwt_required
|
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):
|
class ClearSimulationData(AbstractResource):
|
||||||
urls = ["/api/clear-simulation-data"]
|
urls = ["/api/clear-simulation-data"]
|
||||||
|
|
||||||
def __init__(self, credentials_repository: ICredentialsRepository):
|
def __init__(self, repository_service: RepositoryService):
|
||||||
self._credentials_repository = credentials_repository
|
self._repository_service = repository_service
|
||||||
|
|
||||||
@jwt_required
|
@jwt_required
|
||||||
def post(self):
|
def post(self):
|
||||||
"""
|
"""
|
||||||
Clear all data collected during the simulation
|
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)
|
return make_response({}, HTTPStatus.OK)
|
||||||
|
|
Loading…
Reference in New Issue