Skip to content

Commit

Permalink
[Security Solution][Detection Engine] updates missing privileges for … (
Browse files Browse the repository at this point in the history
#169916)

## Summary

- addresses elastic/security-docs#4069
- changes text .lists, .items indices to .lists, .items data streams

### Before


![image](https://github.com/elastic/kibana/assets/92328789/00f42f47-2cd2-4667-b07c-70fa21ba429d)



### After

<img width="2560" alt="Screenshot 2023-10-26 at 10 58 18"
src="https://github.com/elastic/kibana/assets/92328789/93fff167-c6a7-437e-9618-7724a4249872">
  • Loading branch information
vitaliidm authored Oct 27, 2023
1 parent ca660da commit 7266ab5
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const missingPrivilegesCallOutBody = ({
/>
<ul>
{indexPrivileges.map(([index, missingPrivileges]) => (
<li key={index}>{missingIndexPrivileges(index, missingPrivileges)}</li>
<li key={index}>{missingPrivilegesMessage(index, missingPrivileges)}</li>
))}
</ul>
</>
Expand Down Expand Up @@ -140,6 +140,19 @@ const getPrivilegesExplanation = (missingPrivileges: string[], index: string) =>
.join(' ');
};

const missingPrivilegesMessage = (index: string, privileges: string[]) => {
// .lists and .items are data streams, so we will show it in the message
if (
[DEFAULT_LISTS_INDEX, DEFAULT_ITEMS_INDEX].some((dataStreamName) =>
index.startsWith(dataStreamName)
)
) {
return missingDataStreamPrivileges(index, privileges);
}

return missingIndexPrivileges(index, privileges);
};

const missingIndexPrivileges = (index: string, privileges: string[]) => (
<FormattedMessage
id="xpack.securitySolution.detectionEngine.missingPrivilegesCallOut.messageBody.missingIndexPrivileges"
Expand All @@ -152,6 +165,18 @@ const missingIndexPrivileges = (index: string, privileges: string[]) => (
/>
);

const missingDataStreamPrivileges = (dataStream: string, privileges: string[]) => (
<FormattedMessage
id="xpack.securitySolution.detectionEngine.missingPrivilegesCallOut.messageBody.missingDataStreamPrivileges"
defaultMessage="Missing {privileges} privileges for the {dataStream} data stream. {explanation}"
values={{
privileges: <CommaSeparatedValues values={privileges} />,
dataStream: <EuiCode>{dataStream}</EuiCode>,
explanation: getPrivilegesExplanation(privileges, dataStream),
}}
/>
);

const missingFeaturePrivileges = (feature: string, privileges: string[]) => (
<FormattedMessage
id="xpack.securitySolution.detectionEngine.missingPrivilegesCallOut.messageBody.missingFeaturePrivileges"
Expand Down

0 comments on commit 7266ab5

Please sign in to comment.