Skip to content

Commit

Permalink
feat: merge
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 Aug 27, 2023
1 parent d1e6b90 commit 11ce883
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/plugins/workspace/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ export class WorkspacePlugin implements Plugin<{}, {}> {
workspaceSavedObjectsClientWrapper.wrapperFactory
);

core.savedObjects.setClientFactoryProvider(
(repositoryFactory) => ({ request, includedHiddenTypes }) => {
const enabled = this.isEnabled;
if (enabled) {
return new SavedObjectsClient(repositoryFactory.createInternalRepository());
}

return new SavedObjectsClient(
repositoryFactory.createScopedRepository(request, includedHiddenTypes)
);
}
);

this.proxyWorkspaceTrafficToRealHandler(core);

registerRoutes({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ export class WorkspaceSavedObjectsClientWrapper {

const isDashboardAdmin = this.isDashboardAdmin(wrapperOptions.request);

if (isDashboardAdmin || !this.options.enabled$.getValue()) {
if (isDashboardAdmin) {
return wrapperOptions.client;
}

Expand Down

0 comments on commit 11ce883

Please sign in to comment.