Island: Change PATCH to PUT in propagation_credentials resource
* Add support to put stolen credentials
This commit is contained in:
parent
45884ff233
commit
89299bac6d
|
@ -42,13 +42,20 @@ class PropagationCredentials(AbstractResource):
|
||||||
|
|
||||||
return {}, HTTPStatus.NO_CONTENT
|
return {}, HTTPStatus.NO_CONTENT
|
||||||
|
|
||||||
def patch(self, collection=None):
|
def put(self, collection=None):
|
||||||
if collection != _configured_collection:
|
|
||||||
return {}, HTTPStatus.METHOD_NOT_ALLOWED
|
|
||||||
|
|
||||||
credentials = [Credentials.from_mapping(c) for c in request.json]
|
credentials = [Credentials.from_mapping(c) for c in request.json]
|
||||||
self._credentials_repository.remove_configured_credentials()
|
|
||||||
self._credentials_repository.save_configured_credentials(credentials)
|
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:
|
||||||
|
return {}, HTTPStatus.METHOD_NOT_ALLOWED
|
||||||
|
else:
|
||||||
|
return {}, HTTPStatus.NOT_FOUND
|
||||||
|
|
||||||
return {}, HTTPStatus.NO_CONTENT
|
return {}, HTTPStatus.NO_CONTENT
|
||||||
|
|
||||||
def delete(self, collection=None):
|
def delete(self, collection=None):
|
||||||
|
|
|
@ -42,7 +42,6 @@ const ConfigImportModal = (props: Props) => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (configContents !== null && configCredentials !== null) {
|
if (configContents !== null && configCredentials !== null) {
|
||||||
console.log("useEffect was called");
|
|
||||||
tryImport();
|
tryImport();
|
||||||
}
|
}
|
||||||
}, [configContents, configCredentials, unsafeOptionsVerified])
|
}, [configContents, configCredentials, unsafeOptionsVerified])
|
||||||
|
@ -80,7 +79,7 @@ const ConfigImportModal = (props: Props) => {
|
||||||
console.log(credentials);
|
console.log(credentials);
|
||||||
authComponent.authFetch(credentialsEndpoint,
|
authComponent.authFetch(credentialsEndpoint,
|
||||||
{
|
{
|
||||||
method: 'PATCH',
|
method: 'PUT',
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
body: JSON.stringify(credentials)
|
body: JSON.stringify(credentials)
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,7 @@ class ConfigurePageComponent extends AuthComponent {
|
||||||
return (
|
return (
|
||||||
this.authFetch(CONFIGURED_PROPAGATION_CREDENTIALS_URL,
|
this.authFetch(CONFIGURED_PROPAGATION_CREDENTIALS_URL,
|
||||||
{
|
{
|
||||||
method: 'PATCH',
|
method: 'PUT',
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
body: JSON.stringify(formatCredentialsForIsland(this.state.credentials))
|
body: JSON.stringify(formatCredentialsForIsland(this.state.credentials))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue