diff --git a/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.test.tsx index b2c97a33b2ff4..7b51958df18b3 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.test.tsx @@ -146,6 +146,24 @@ describe('EntityStoreEnablementModal', () => { expect(enableButton).toBeDisabled(); }); + it('should show proceed warning when riskScore is enabled but entityStore is disabled and unchecked', () => { + renderComponent({ + ...defaultProps, + riskScore: { disabled: false, checked: false }, // Enabled & Checked + entityStore: { disabled: true, checked: false }, // Disabled & Unchecked + }); + expect(screen.getByText('Please enable at least one option to proceed.')).toBeInTheDocument(); + }); + + it('should show proceed warning when entityStore is enabled but riskScore is disabled and unchecked', () => { + renderComponent({ + ...defaultProps, + entityStore: { disabled: false, checked: false }, // Enabled & Checked + riskScore: { disabled: true, checked: false }, // Disabled & Unchecked + }); + expect(screen.getByText('Please enable at least one option to proceed.')).toBeInTheDocument(); + }); + it('should not show entity engine missing privileges warning when no missing privileges', () => { renderComponent(); expect( diff --git a/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.tsx b/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.tsx index 6ece2fea1b223..e104c6a76bb88 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.tsx @@ -54,6 +54,20 @@ interface EntityStoreEnablementModalProps { }; } +const shouldAllowEnablement = ( + riskScoreEnabled: boolean, + entityStoreEnabled: boolean, + enablements: Enablements +) => { + if (riskScoreEnabled) { + return enablements.entityStore; + } + if (entityStoreEnabled) { + return enablements.riskScore; + } + return enablements.riskScore || enablements.entityStore; +}; + export const EntityStoreEnablementModal: React.FC = ({ visible, toggle, @@ -69,7 +83,12 @@ export const EntityStoreEnablementModal: React.FC