Skip to content

Commit

Permalink
feat: add workspace into includeHiddenTypes of client wrapper and per…
Browse files Browse the repository at this point in the history
…mission control client

Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Feb 26, 2024
1 parent fe9a4c1 commit 4094681
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/plugins/workspace/server/permission_control/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { i18n } from '@osd/i18n';
import { OpenSearchDashboardsRequest, Principals, SavedObject } from '../../../../core/server';
import {
OpenSearchDashboardsRequest,
Principals,
SavedObject,
WORKSPACE_TYPE,
} from '../../../../core/server';
import {
ACL,
TransformedPermission,
Expand All @@ -27,6 +32,7 @@ export class SavedObjectsPermissionControl {
private getScopedClient(request: OpenSearchDashboardsRequest) {
return this._getScopedClient?.(request, {
excludedWrappers: [WORKSPACE_SAVED_OBJECTS_CLIENT_WRAPPER_ID],
includedHiddenTypes: [WORKSPACE_TYPE],
});
}

Expand Down
7 changes: 6 additions & 1 deletion src/plugins/workspace/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Plugin,
Logger,
SavedObjectsClient,
WORKSPACE_TYPE,
} from '../../../core/server';
import { IWorkspaceClientImpl } from './types';
import { WorkspaceClientWithSavedObject } from './workspace_client';
Expand Down Expand Up @@ -92,7 +93,11 @@ export class WorkspacePlugin implements Plugin<{}, {}> {

core.savedObjects.setClientFactoryProvider(
(repositoryFactory) => ({ includedHiddenTypes }: { includedHiddenTypes?: string[] }) =>
new SavedObjectsClient(repositoryFactory.createInternalRepository(includedHiddenTypes))
new SavedObjectsClient(
repositoryFactory.createInternalRepository([
...new Set([WORKSPACE_TYPE, ...(includedHiddenTypes || [])]),
])
)
);

core.capabilities.registerProvider(() => ({
Expand Down

0 comments on commit 4094681

Please sign in to comment.