diff --git a/src/core/public/saved_objects/saved_objects_client.ts b/src/core/public/saved_objects/saved_objects_client.ts index 45d8d5402b8f..6d8901a9489b 100644 --- a/src/core/public/saved_objects/saved_objects_client.ts +++ b/src/core/public/saved_objects/saved_objects_client.ts @@ -266,13 +266,9 @@ export class SavedObjectsClient { }; const currentWorkspaceId = this._getCurrentWorkspace(); let finalWorkspaces; - if (options.workspaces) { + if (options.hasOwnProperty('workspaces')) { finalWorkspaces = options.workspaces; } else if (typeof currentWorkspaceId === 'string') { - /** - * When the currentWorkspaceId is an empty string instead of undefined - * It means user is creating object in public workspace. - */ finalWorkspaces = [currentWorkspaceId]; } @@ -383,10 +379,13 @@ export class SavedObjectsClient { const currentWorkspaceId = this._getCurrentWorkspace(); let finalWorkspaces; - if (options.workspaces) { + if (options.hasOwnProperty('workspaces')) { finalWorkspaces = options.workspaces; } else if (typeof currentWorkspaceId === 'string') { - finalWorkspaces = currentWorkspaceId ? [PUBLIC_WORKSPACE, currentWorkspaceId] : undefined; + finalWorkspaces = + currentWorkspaceId === PUBLIC_WORKSPACE + ? undefined + : [PUBLIC_WORKSPACE, currentWorkspaceId]; } const renamedQuery = renameKeys(renameMap, { diff --git a/src/core/server/workspaces/saved_objects/workspace_saved_objects_client_wrapper.ts b/src/core/server/workspaces/saved_objects/workspace_saved_objects_client_wrapper.ts index 84165deb66c7..f70f7aa3b0f6 100644 --- a/src/core/server/workspaces/saved_objects/workspace_saved_objects_client_wrapper.ts +++ b/src/core/server/workspaces/saved_objects/workspace_saved_objects_client_wrapper.ts @@ -220,19 +220,7 @@ export class WorkspaceSavedObjectsClientWrapper { throw generateWorkspacePermissionError(); } } else { - const queryDSL = ACL.genereateGetPermittedSavedObjectsQueryDSL( - [ - PermissionMode.LibraryRead, - PermissionMode.LibraryWrite, - PermissionMode.Management, - PermissionMode.Read, - PermissionMode.Write, - ], - principals, - options.type - ); options.workspaces = permittedWorkspaceIds; - options.queryDSL = queryDSL; } } diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx index b82fede2498e..867fb4868957 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx @@ -180,7 +180,7 @@ export class SavedObjectsTable extends Component