diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_navigation_items.tsx b/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_navigation_items.tsx index 9b76b7f6bc194..ea1448e57398b 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_navigation_items.tsx +++ b/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_navigation_items.tsx @@ -21,6 +21,9 @@ import { SecurityPageName } from '../../../../../common/constants'; import { useCanSeeHostIsolationExceptionsMenu } from '../../../../management/pages/host_isolation_exceptions/view/hooks'; import { useIsExperimentalFeatureEnabled } from '../../../hooks/use_experimental_features'; import { useGlobalQueryString } from '../../../utils/global_query_string'; +import { useMlCapabilities } from '../../ml/hooks/use_ml_capabilities'; +import { hasMlUserPermissions } from '../../../../../common/machine_learning/has_ml_user_permissions'; +import { hasMlLicense } from '../../../../../common/machine_learning/has_ml_license'; export const usePrimaryNavigationItems = ({ navTabs, @@ -72,8 +75,10 @@ function usePrimaryNavigationItemsToDisplay(navTabs: Record) { const hasCasesReadPermissions = useGetUserCasesPermissions().read; const canSeeHostIsolationExceptions = useCanSeeHostIsolationExceptionsMenu(); const isPolicyListEnabled = useIsExperimentalFeatureEnabled('policyListEnabled'); - const isEntityAnalyticsDashoardEnabled = useIsExperimentalFeatureEnabled( - 'entityAnalyticsDashoardEnabled' + const mlCapabilities = useMlCapabilities(); + const hasMlPermissions = hasMlLicense(mlCapabilities) && hasMlUserPermissions(mlCapabilities); + const isEntityAnalyticsDashboardEnabled = useIsExperimentalFeatureEnabled( + 'entityAnalyticsDashboardEnabled' ); const uiCapabilities = useKibana().services.application.capabilities; return useMemo( @@ -94,7 +99,7 @@ function usePrimaryNavigationItemsToDisplay(navTabs: Record) { ...(navTabs[SecurityPageName.kubernetes] != null ? [navTabs[SecurityPageName.kubernetes]] : []), - ...(isEntityAnalyticsDashoardEnabled + ...(isEntityAnalyticsDashboardEnabled && hasMlPermissions ? [navTabs[SecurityPageName.entityAnalytics]] : []), ], @@ -157,10 +162,11 @@ function usePrimaryNavigationItemsToDisplay(navTabs: Record) { [ uiCapabilities.siem.show, navTabs, - isEntityAnalyticsDashoardEnabled, + isEntityAnalyticsDashboardEnabled, hasCasesReadPermissions, canSeeHostIsolationExceptions, isPolicyListEnabled, + hasMlPermissions, ] ); }