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 19, 2023
1 parent 6c2a6ae commit 9201b6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 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';

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

const findWithWorkspacePermissionControl = async <T = unknown>(
options: SavedObjectsFindOptions & Pick<WorkspaceFindOptions, 'permissionModes'>
options: SavedObjectsFindOptions
) => {
const principals = this.permissionControl.getPrincipalsFromRequest(wrapperOptions.request);
if (!options.ACLSearchParams) {
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/workspace/server/workspace_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ export class WorkspaceClientWithSavedObject implements IWorkspaceDBImpl {
options: WorkspaceFindOptions
): ReturnType<IWorkspaceDBImpl['list']> {
try {
const { permissionModes, ...restOptions } = options;
const {
saved_objects: savedObjects,
...others
} = await this.getSavedObjectClientsFromRequestDetail(requestDetail).find<WorkspaceAttribute>(
{
...options,
...restOptions,
type: WORKSPACE_TYPE,
...(permissionModes ? { ACLSearchParams: { permissionModes } } : {}),
}
);
return {
Expand Down

0 comments on commit 9201b6d

Please sign in to comment.