diff --git a/monkey/monkey_island/cc/resources/propagation_credentials.py b/monkey/monkey_island/cc/resources/propagation_credentials.py index c5dfc42fe..9ef22f832 100644 --- a/monkey/monkey_island/cc/resources/propagation_credentials.py +++ b/monkey/monkey_island/cc/resources/propagation_credentials.py @@ -29,7 +29,7 @@ class PropagationCredentials(AbstractResource): return propagation_credentials, HTTPStatus.OK def post(self, collection=None): - credentials = [Credentials.from_json(c) for c in request.json] + credentials = [Credentials.from_mapping(c) for c in request.json] if collection == _configured_collection: self._credentials_repository.save_configured_credentials(credentials) @@ -42,6 +42,15 @@ class PropagationCredentials(AbstractResource): return {}, HTTPStatus.NO_CONTENT + def patch(self, collection=None): + if collection != _configured_collection: + return {}, HTTPStatus.METHOD_NOT_ALLOWED + + credentials = [Credentials.from_mapping(c) for c in request.json] + self._credentials_repository.remove_configured_credentials() + self._credentials_repository.save_configured_credentials(credentials) + return {}, HTTPStatus.NO_CONTENT + def delete(self, collection=None): if collection == _configured_collection: self._credentials_repository.remove_configured_credentials()