diff --git a/x-pack/plugins/actions/server/plugin.ts b/x-pack/plugins/actions/server/plugin.ts index 539845221e485..ea69eff769a4e 100644 --- a/x-pack/plugins/actions/server/plugin.ts +++ b/x-pack/plugins/actions/server/plugin.ts @@ -296,11 +296,11 @@ export class ActionsPlugin implements Plugin, Plugi return request => ({ callCluster: elasticsearch.legacy.client.asScoped(request).callAsCurrentUser, savedObjectsClient: savedObjects.getScopedClient(request), - getScopedClusterClient(clusterClient: IClusterClient) { + getScopedCallCluster(clusterClient: IClusterClient) { if (!(clusterClient instanceof ClusterClient)) { throw new Error('given clusterClient is not an instance of ClusterClient'); } - return clusterClient.asScoped(request); + return clusterClient.asScoped(request).callAsCurrentUser; }, }); } diff --git a/x-pack/plugins/actions/server/types.ts b/x-pack/plugins/actions/server/types.ts index 6804d89e949e2..3ccaf04916dfb 100644 --- a/x-pack/plugins/actions/server/types.ts +++ b/x-pack/plugins/actions/server/types.ts @@ -24,7 +24,7 @@ export type SpaceIdToNamespaceFunction = (spaceId?: string) => string | undefine export interface Services { callCluster(path: string, opts: any): Promise; savedObjectsClient: SavedObjectsClientContract; - getScopedClusterClient(clusterClient: IClusterClient): IScopedClusterClient; + getScopedCallCluster(clusterClient: IClusterClient): IScopedClusterClient['callAsCurrentUser']; } declare module 'src/core/server' { diff --git a/x-pack/plugins/alerting/server/plugin.ts b/x-pack/plugins/alerting/server/plugin.ts index 99ba2e4b6cea1..1cadfde15f676 100644 --- a/x-pack/plugins/alerting/server/plugin.ts +++ b/x-pack/plugins/alerting/server/plugin.ts @@ -269,11 +269,11 @@ export class AlertingPlugin { return request => ({ callCluster: elasticsearch.legacy.client.asScoped(request).callAsCurrentUser, savedObjectsClient: savedObjects.getScopedClient(request), - getScopedClusterClient(clusterClient: IClusterClient) { + getScopedCallCluster(clusterClient: IClusterClient) { if (!(clusterClient instanceof ClusterClient)) { throw new Error('given clusterClient is not an instance of ClusterClient'); } - return clusterClient.asScoped(request); + return clusterClient.asScoped(request).callAsCurrentUser; }, }); } diff --git a/x-pack/plugins/alerting/server/types.ts b/x-pack/plugins/alerting/server/types.ts index 0eff6c3a66072..f209a5b606028 100644 --- a/x-pack/plugins/alerting/server/types.ts +++ b/x-pack/plugins/alerting/server/types.ts @@ -36,7 +36,7 @@ declare module 'src/core/server' { export interface Services { callCluster(path: string, opts: any): Promise; savedObjectsClient: SavedObjectsClientContract; - getScopedClusterClient(clusterClient: IClusterClient): IScopedClusterClient; + getScopedCallCluster(clusterClient: IClusterClient): IScopedClusterClient['callAsCurrentUser']; } export interface AlertServices extends Services {