Island: Remove POST in propagation credentials endpoint

Post is not used, because configuration credentials are put all at once and stolen credentials are added via telemetry
This commit is contained in:
vakarisz 2022-07-28 13:06:20 +03:00
parent 40b29ba99a
commit 6e821c5bbc
1 changed files with 1 additions and 18 deletions

View File

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