diff --git a/monkey/monkey_island/cc/resources/propagation_credentials.py b/monkey/monkey_island/cc/resources/propagation_credentials.py index f3cd05132..f1ae01c81 100644 --- a/monkey/monkey_island/cc/resources/propagation_credentials.py +++ b/monkey/monkey_island/cc/resources/propagation_credentials.py @@ -28,30 +28,13 @@ class PropagationCredentials(AbstractResource): return propagation_credentials, HTTPStatus.OK - def post(self, collection=None): - credentials = [Credentials.from_mapping(c) for c in request.json] - - if collection == _configured_collection: - self._credentials_repository.save_configured_credentials(credentials) - elif collection == _stolen_collection: - self._credentials_repository.save_stolen_credentials(credentials) - elif collection is None: - return {}, HTTPStatus.METHOD_NOT_ALLOWED - else: - return {}, HTTPStatus.NOT_FOUND - - return {}, HTTPStatus.NO_CONTENT - def put(self, collection=None): credentials = [Credentials.from_mapping(c) for c in request.json] if collection == _configured_collection: self._credentials_repository.remove_configured_credentials() self._credentials_repository.save_configured_credentials(credentials) - elif collection == _stolen_collection: - self._credentials_repository.remove_stolen_credentials() - self._credentials_repository.save_stolen_credentials(credentials) - elif collection is None: + elif collection is None or collection == _stolen_collection: return {}, HTTPStatus.METHOD_NOT_ALLOWED else: return {}, HTTPStatus.NOT_FOUND