From f014ca46bcf6e6fd6250f0e3e72ed0fa1b734f8d Mon Sep 17 00:00:00 2001
From: Milton Hultgren
Date: Thu, 15 Sep 2022 11:36:11 +0100
Subject: [PATCH] [Stack Monitoring] Verify remote cluster client role when CCS
is enabled (#140738)
* [Stack Monitoring] Verify remote cluster client role when CCS is enabled (#129546)
* Only show UI hint if CCS is enabled
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
---
.../contexts/external_config_context.tsx | 1 +
.../application/pages/access_denied/index.tsx | 12 ++++++-
x-pack/plugins/monitoring/public/plugin.ts | 1 +
.../server/lib/errors/auth_errors.ts | 13 ++++++--
.../api/v1/check_access/check_access.ts | 33 +++++++++++++++++++
5 files changed, 56 insertions(+), 4 deletions(-)
diff --git a/x-pack/plugins/monitoring/public/application/contexts/external_config_context.tsx b/x-pack/plugins/monitoring/public/application/contexts/external_config_context.tsx
index 805a39e2bf69e..e86262defb65e 100644
--- a/x-pack/plugins/monitoring/public/application/contexts/external_config_context.tsx
+++ b/x-pack/plugins/monitoring/public/application/contexts/external_config_context.tsx
@@ -13,6 +13,7 @@ export interface ExternalConfig {
showCgroupMetricsLogstash: boolean;
renderReactApp: boolean;
staleStatusThresholdSeconds: number;
+ isCcsEnabled: boolean;
}
export const ExternalConfigContext = createContext({} as ExternalConfig);
diff --git a/x-pack/plugins/monitoring/public/application/pages/access_denied/index.tsx b/x-pack/plugins/monitoring/public/application/pages/access_denied/index.tsx
index 80c2839131047..363225cedf7dd 100644
--- a/x-pack/plugins/monitoring/public/application/pages/access_denied/index.tsx
+++ b/x-pack/plugins/monitoring/public/application/pages/access_denied/index.tsx
@@ -5,7 +5,7 @@
* 2.0.
*/
-import React, { useState } from 'react';
+import React, { useContext, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiPanel, EuiCallOut, EuiButton } from '@elastic/eui';
@@ -14,8 +14,10 @@ import { Redirect } from 'react-router-dom';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { ComponentProps } from '../../route_init';
import { MonitoringStartPluginDependencies } from '../../../types';
+import { ExternalConfigContext } from '../../contexts/external_config_context';
export const AccessDeniedPage: React.FC = () => {
+ const { isCcsEnabled } = useContext(ExternalConfigContext);
const { services } = useKibana();
const [hasAccess, setHasAccess] = useState(false);
@@ -62,6 +64,14 @@ export const AccessDeniedPage: React.FC = () => {
the monitoring cluster."
/>
+ {isCcsEnabled && (
+
+
+
+ )}