diff --git a/src/core/public/saved_objects/saved_objects_client.test.ts b/src/core/public/saved_objects/saved_objects_client.test.ts index d15037eec9ec..c3cde2f6d6c3 100644 --- a/src/core/public/saved_objects/saved_objects_client.test.ts +++ b/src/core/public/saved_objects/saved_objects_client.test.ts @@ -198,7 +198,6 @@ describe('SavedObjectsClient', () => { "method": "DELETE", "query": Object { "force": false, - "workspace": undefined, }, }, ] diff --git a/src/core/public/saved_objects/saved_objects_client.ts b/src/core/public/saved_objects/saved_objects_client.ts index dd7951db8ecf..f1f3b87c6dc7 100644 --- a/src/core/public/saved_objects/saved_objects_client.ts +++ b/src/core/public/saved_objects/saved_objects_client.ts @@ -112,7 +112,6 @@ export interface SavedObjectsBatchResponse { export interface SavedObjectsDeleteOptions { /** Force deletion of an object that exists in multiple namespaces */ force?: boolean; - workspace?: string; } /** @@ -337,7 +336,6 @@ export class SavedObjectsClient { const query = { force: !!options?.force, - workspace: this._getCurrentWorkspace(), }; return this.savedObjectsFetch(this.getPath([type, id]), { method: 'DELETE', query }); diff --git a/src/core/server/saved_objects/routes/delete.ts b/src/core/server/saved_objects/routes/delete.ts index 20abc37d9af1..25296fe6855f 100644 --- a/src/core/server/saved_objects/routes/delete.ts +++ b/src/core/server/saved_objects/routes/delete.ts @@ -42,17 +42,13 @@ export const registerDeleteRoute = (router: IRouter) => { }), query: schema.object({ force: schema.maybe(schema.boolean()), - workspace: schema.maybe(schema.string()), }), }, }, router.handleLegacyErrors(async (context, req, res) => { const { type, id } = req.params; - const { force, workspace } = req.query; - const result = await context.core.savedObjects.client.delete(type, id, { - force, - workspaces: workspace ? [workspace] : undefined, - }); + const { force } = req.query; + const result = await context.core.savedObjects.client.delete(type, id, { force }); return res.ok({ body: result }); }) ); diff --git a/src/core/server/saved_objects/service/lib/repository.test.js b/src/core/server/saved_objects/service/lib/repository.test.js index d97ad64c66cc..816d1013e5be 100644 --- a/src/core/server/saved_objects/service/lib/repository.test.js +++ b/src/core/server/saved_objects/service/lib/repository.test.js @@ -2554,25 +2554,6 @@ describe('SavedObjectsRepository', () => { expect(client.get).toHaveBeenCalledTimes(1); }); - it(`throws when the document has multiple workspaces and the force option is not enabled`, async () => { - const workspaces = ['foo-workspace', 'bar-workspace']; - const response = getMockGetResponse({ - type: NAMESPACE_AGNOSTIC_TYPE, - id, - namespace, - workspaces, - }); - client.get.mockResolvedValueOnce( - opensearchClientMock.createSuccessTransportRequestPromise(response) - ); - await expect( - savedObjectsRepository.delete(NAMESPACE_AGNOSTIC_TYPE, id, { namespace, workspaces }) - ).rejects.toThrowError( - 'Unable to delete saved object that exists in multiple workspaces, use the `force` option to delete it anyway' - ); - expect(client.get).toHaveBeenCalledTimes(1); - }); - it(`throws when the type is multi-namespace and the document has all namespaces and the force option is not enabled`, async () => { const response = getMockGetResponse({ type: MULTI_NAMESPACE_TYPE, id, namespace }); response._source.namespaces = ['*']; diff --git a/src/core/server/saved_objects/service/lib/repository.ts b/src/core/server/saved_objects/service/lib/repository.ts index 61cc60b4add1..1b7560505947 100644 --- a/src/core/server/saved_objects/service/lib/repository.ts +++ b/src/core/server/saved_objects/service/lib/repository.ts @@ -725,17 +725,6 @@ export class SavedObjectsRepository { } } - const { workspaces } = options; - if (workspaces) { - const obj = await this.get(type, id, { namespace }); - const existingWorkspace = obj.workspaces || []; - if (!force && existingWorkspace.length > 1) { - throw SavedObjectsErrorHelpers.createBadRequestError( - 'Unable to delete saved object that exists in multiple workspaces, use the `force` option to delete it anyway' - ); - } - } - const { body, statusCode } = await this.client.delete( { id: rawId,