Skip to content

Commit

Permalink
feat: remove permissionModes in savedobject client find method
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Wang <wonglam@amazon.com>
  • Loading branch information
wanglam committed Sep 20, 2023
1 parent 3d3fc1e commit f11d660
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
SavedObjectsErrorHelpers,
} from '../../../../core/server';
import { SavedObjectsPermissionControlContract } from '../permission_control/client';
import { WorkspaceFindOptions } from '../types';
import { getPrincipalsFromRequest } from '../utils';

const ALL_WORKSPACE_INNER_DATA_PERMISSION_MODES: string[] = [
Expand Down Expand Up @@ -361,7 +360,7 @@ export class WorkspaceSavedObjectsClientWrapper {
};

const findWithWorkspacePermissionControl = async <T = unknown>(
options: SavedObjectsFindOptions & Pick<WorkspaceFindOptions, 'permissionModes'>
options: SavedObjectsFindOptions
) => {
const principals = getPrincipalsFromRequest(wrapperOptions.request);
if (!options.ACLSearchParams) {
Expand Down
7 changes: 5 additions & 2 deletions src/plugins/workspace/server/workspace_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,13 @@ export class WorkspaceClientWithSavedObject implements IWorkspaceDBImpl {
options: WorkspaceFindOptions
): ReturnType<IWorkspaceDBImpl['list']> {
try {
const { permissionModes, ...restOptions } = options;
const resultResp = await this.getSavedObjectClientsFromRequestDetail(requestDetail).find<
WorkspaceAttribute
>({
...options,
...restOptions,
type: WORKSPACE_TYPE,
...(permissionModes ? { ACLSearchParams: { permissionModes } } : {}),
});
const others = omit(resultResp, 'saved_objects');
let savedObjects = resultResp.saved_objects;
Expand Down Expand Up @@ -284,8 +286,9 @@ export class WorkspaceClientWithSavedObject implements IWorkspaceDBImpl {
const retryFindResp = await this.getSavedObjectClientsFromRequestDetail(
requestDetail
).find<WorkspaceAttribute>({
...options,
...restOptions,
type: WORKSPACE_TYPE,
...(permissionModes ? { ACLSearchParams: { permissionModes } } : {}),
});
savedObjects = retryFindResp.saved_objects;
}
Expand Down

0 comments on commit f11d660

Please sign in to comment.