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 (