Skip to content

Commit 72eab3c

Browse files
committed
don't show form unless user has read permissions for actions, display text saying user is missing required privileges
1 parent a0af097 commit 72eab3c

File tree

1 file changed

+11
-6
lines changed
  • x-pack/plugins/security_solution/public/detections/components/rules/step_rule_actions

1 file changed

+11
-6
lines changed

x-pack/plugins/security_solution/public/detections/components/rules/step_rule_actions/index.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
EuiFlexItem,
1212
EuiButton,
1313
EuiSpacer,
14+
EuiText,
1415
} from '@elastic/eui';
1516
import { findIndex } from 'lodash/fp';
1617
import React, { FC, memo, useCallback, useEffect, useMemo } from 'react';
@@ -125,11 +126,8 @@ const StepRuleActionsComponent: FC<StepRuleActionsProps> = ({
125126
}, [getData, setForm]);
126127

127128
const throttleOptions = useMemo(() => {
128-
if (application.capabilities.actions.show) {
129-
return getThrottleOptions(throttle);
130-
}
131-
return [{ value: DEFAULT_THROTTLE_OPTION.value, text: I18n.NO_ACTIONS_READ_PERMISSIONS }];
132-
}, [throttle, application.capabilities.actions.show]);
129+
return getThrottleOptions(throttle);
130+
}, [throttle]);
133131

134132
const throttleFieldComponentProps = useMemo(
135133
() => ({
@@ -151,7 +149,11 @@ const StepRuleActionsComponent: FC<StepRuleActionsProps> = ({
151149
) : (
152150
<>
153151
<StepContentWrapper addPadding={!isUpdateView}>
154-
<Form form={form} data-test-subj="stepRuleActions">
152+
<Form
153+
form={form}
154+
style={{ display: application.capabilities.actions.show ? 'block' : 'none' }}
155+
data-test-subj="stepRuleActions"
156+
>
155157
<EuiForm>
156158
<UseField
157159
path="throttle"
@@ -176,6 +178,9 @@ const StepRuleActionsComponent: FC<StepRuleActionsProps> = ({
176178
<UseField path="enabled" component={GhostFormField} />
177179
</EuiForm>
178180
</Form>
181+
{!application.capabilities.actions.show && (
182+
<EuiText>{I18n.NO_ACTIONS_READ_PERMISSIONS}</EuiText>
183+
)}
179184
</StepContentWrapper>
180185

181186
{!isUpdateView && (

0 commit comments

Comments
 (0)