From 0c44f5fd41be17ec048b33d8e47ebee64f1d35ce Mon Sep 17 00:00:00 2001 From: Kerry Gallagher Date: Tue, 16 Feb 2021 19:37:25 +0000 Subject: [PATCH] [Logs UI] Check for privileges with user management links (#91134) (#91490) * Wrap users management link with privileges check Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../log_analysis_setup/user_management_link.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/x-pack/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx index 24179768604c..3b0eb6fa8985 100644 --- a/x-pack/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx @@ -9,12 +9,23 @@ import { EuiButton, EuiButtonProps } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; import { useLinkProps } from '../../../hooks/use_link_props'; +import { useKibanaContextForPlugin } from '../../../hooks/use_kibana'; export const UserManagementLink: React.FunctionComponent = (props) => { + const { + services: { + application: { capabilities }, + }, + } = useKibanaContextForPlugin(); + const canAccessUserManagement = capabilities?.management?.security?.users ?? false; + const linkProps = useLinkProps({ app: 'management', pathname: '/security/users', }); + + if (!canAccessUserManagement) return null; + return (