Skip to content

Commit

Permalink
feat: Only allow workspace CRUD APIs to modify workspace metadata.
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
SuZhou-Joe committed Oct 27, 2023
1 parent 87e8f71 commit 86871a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/plugins/workspace/server/saved_objects/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { SavedObjectsType, WORKSPACE_TYPE } from '../../../../core/server';
export const workspace: SavedObjectsType = {
name: WORKSPACE_TYPE,
namespaceType: 'agnostic',
hidden: false,
/**
* Disable operation by using saved objects APIs on workspace metadata
*/
hidden: true,
/**
* workspace won't appear in management page.
*/
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/workspace/server/workspace_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ export class WorkspaceClient implements IWorkspaceClientImpl {
): SavedObjectsClientContract | undefined {
return this.savedObjects?.getScopedClient(requestDetail.request, {
excludedWrappers: [WORKSPACE_SAVED_OBJECTS_CLIENT_WRAPPER_ID],
includedHiddenTypes: [WORKSPACE_TYPE],
});
}

private getSavedObjectClientsFromRequestDetail(
requestDetail: IRequestDetail
): SavedObjectsClientContract {
return requestDetail.context.core.savedObjects.client;
return this.savedObjects?.getScopedClient(requestDetail.request, {
includedHiddenTypes: [WORKSPACE_TYPE],
}) as SavedObjectsClientContract;
}
private getFlattenedResultWithSavedObject(
savedObject: SavedObject<WorkspaceAttribute>
Expand Down

0 comments on commit 86871a5

Please sign in to comment.