Skip to content

Commit fadcc14

Browse files
authored
[Security Solution][Endpoint][Admin] Disables malware checkbox when switch is off and can now save in detect mode (#86402) (#86510)
1 parent 839c4a7 commit fadcc14

File tree

1 file changed

+17
-8
lines changed
  • x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections

1 file changed

+17
-8
lines changed

x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/malware.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,27 @@ const ProtectionRadio = React.memo(({ id, label }: { id: ProtectionModes; label:
5555
const radioButtonId = useMemo(() => htmlIdGenerator()(), []);
5656
// currently just taking windows.malware, but both windows.malware and mac.malware should be the same value
5757
const selected = policyDetailsConfig && policyDetailsConfig.windows.malware.mode;
58+
const isPlatinumPlus = useLicense().isPlatinumPlus();
5859

5960
const handleRadioChange = useCallback(() => {
6061
if (policyDetailsConfig) {
6162
const newPayload = cloneDeep(policyDetailsConfig);
6263
for (const os of OSes) {
6364
newPayload[os][protection].mode = id;
64-
if (id === ProtectionModes.prevent) {
65-
newPayload[os].popup[protection].enabled = true;
66-
} else {
67-
newPayload[os].popup[protection].enabled = false;
65+
if (isPlatinumPlus) {
66+
if (id === ProtectionModes.prevent) {
67+
newPayload[os].popup[protection].enabled = true;
68+
} else {
69+
newPayload[os].popup[protection].enabled = false;
70+
}
6871
}
6972
}
7073
dispatch({
7174
type: 'userChangedPolicyConfig',
7275
payload: { policyConfig: newPayload },
7376
});
7477
}
75-
}, [dispatch, id, policyDetailsConfig]);
78+
}, [dispatch, id, policyDetailsConfig, isPlatinumPlus]);
7679

7780
/**
7881
* Passing an arbitrary id because EuiRadio
@@ -158,12 +161,16 @@ export const MalwareProtections = React.memo(() => {
158161
if (event.target.checked === false) {
159162
for (const os of OSes) {
160163
newPayload[os][protection].mode = ProtectionModes.off;
161-
newPayload[os].popup[protection].enabled = event.target.checked;
164+
if (isPlatinumPlus) {
165+
newPayload[os].popup[protection].enabled = event.target.checked;
166+
}
162167
}
163168
} else {
164169
for (const os of OSes) {
165170
newPayload[os][protection].mode = ProtectionModes.prevent;
166-
newPayload[os].popup[protection].enabled = event.target.checked;
171+
if (isPlatinumPlus) {
172+
newPayload[os].popup[protection].enabled = event.target.checked;
173+
}
167174
}
168175
}
169176
dispatch({
@@ -172,7 +179,7 @@ export const MalwareProtections = React.memo(() => {
172179
});
173180
}
174181
},
175-
[dispatch, policyDetailsConfig]
182+
[dispatch, policyDetailsConfig, isPlatinumPlus]
176183
);
177184

178185
const handleUserNotificationCheckbox = useCallback(
@@ -243,6 +250,7 @@ export const MalwareProtections = React.memo(() => {
243250
id="xpack.securitySolution.endpoint.policyDetail.malware.userNotification"
244251
onChange={handleUserNotificationCheckbox}
245252
checked={userNotificationSelected}
253+
disabled={selected === ProtectionModes.off}
246254
label={i18n.translate(
247255
'xpack.securitySolution.endpoint.policyDetail.malware.notifyUser',
248256
{
@@ -305,6 +313,7 @@ export const MalwareProtections = React.memo(() => {
305313
);
306314
}, [
307315
radios,
316+
selected,
308317
isPlatinumPlus,
309318
handleUserNotificationCheckbox,
310319
userNotificationSelected,

0 commit comments

Comments
 (0)