Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add workspace into includeHiddenTypes #249

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 || [])]),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this a little bit strange? We can't exclude workspace type anymore, if we don't want to include this type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let me refactor this part, create new client inside the wrapper.

])
)
);

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