[Security Solution] Add Endpoint RBAC documentation url to NoPrivileges page (#145084)

## Summary

When a user doesn't have the needed Kibana Privileges, more precisely
the sub-feature privileges for Security Management pages, they will see
a _Privileges Required_ page. It is already merged, see
https://github.com/elastic/security-team/issues/5222

What is missing is the correct URL for the documentation page. The goal
of this PR is to add this link.
This commit is contained in:
Gergő Ábrahám 2022-11-15 12:14:16 +01:00 committed by GitHub
parent a16c2ac56a
commit ff09e8098a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 16 deletions

View file

@ -381,6 +381,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
exceptions: {
value_lists: `${SECURITY_SOLUTION_DOCS}detections-ui-exceptions.html#manage-value-lists`,
},
privileges: `${SECURITY_SOLUTION_DOCS}endpoint-management-req.html`,
},
query: {
eql: `${ELASTICSEARCH_DOCS}eql.html`,

View file

@ -283,6 +283,7 @@ export interface DocLinks {
readonly exceptions: {
value_lists: string;
};
readonly privileges: string;
};
readonly query: {
readonly eql: string;

View file

@ -10,37 +10,37 @@ import React, { useMemo } from 'react';
import { EuiPageTemplate_Deprecated as EuiPageTemplate } from '@elastic/eui';
import { SecuritySolutionPageWrapper } from '../page_wrapper';
import { EmptyPage } from '../empty_page';
import { useKibana } from '../../lib/kibana';
import * as i18n from './translations';
interface NoPrivilegesPageProps {
documentationUrl: string;
pageName?: string;
}
export const NoPrivilegesPage = React.memo<NoPrivilegesPageProps>(({ pageName }) => {
return (
<SecuritySolutionPageWrapper>
<EuiPageTemplate template="centeredContent">
<NoPrivileges pageName={pageName} />
</EuiPageTemplate>
</SecuritySolutionPageWrapper>
);
});
export const NoPrivilegesPage = React.memo<NoPrivilegesPageProps>(
({ pageName, documentationUrl }) => {
return (
<SecuritySolutionPageWrapper>
<EuiPageTemplate template="centeredContent">
<NoPrivileges pageName={pageName} documentationUrl={documentationUrl} />
</EuiPageTemplate>
</SecuritySolutionPageWrapper>
);
}
);
NoPrivilegesPage.displayName = 'NoPrivilegePage';
export const NoPrivileges = React.memo<NoPrivilegesPageProps>(({ pageName }) => {
const { docLinks } = useKibana().services;
export const NoPrivileges = React.memo<NoPrivilegesPageProps>(({ pageName, documentationUrl }) => {
const emptyPageActions = useMemo(
() => ({
feature: {
icon: 'documents',
label: i18n.GO_TO_DOCUMENTATION,
url: `${docLinks.links.siem.privileges}`,
url: documentationUrl,
target: '_blank',
},
}),
[docLinks]
[documentationUrl]
);
const message = pageName

View file

@ -10,6 +10,7 @@ import { Route } from '@kbn/kibana-react-plugin/public';
import { NoPrivilegesPage } from '../../../common/components/no_privileges';
import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features';
import { NoPermissions } from '../no_permissons';
import { useKibana } from '../../../common/lib/kibana';
import { MANAGEMENT_ROUTING_RESPONSE_ACTIONS_HISTORY_PATH } from '../../common/constants';
export interface PrivilegedRouteProps {
@ -19,6 +20,7 @@ export interface PrivilegedRouteProps {
}
export const PrivilegedRoute = memo(({ component, hasPrivilege, path }: PrivilegedRouteProps) => {
const { docLinks } = useKibana().services;
const isEndpointRbacEnabled = useIsExperimentalFeatureEnabled('endpointRbacEnabled');
const isEndpointRbacV1Enabled = useIsExperimentalFeatureEnabled('endpointRbacV1Enabled');
@ -30,7 +32,7 @@ export const PrivilegedRoute = memo(({ component, hasPrivilege, path }: Privileg
(isEndpointRbacV1Enabled && path === MANAGEMENT_ROUTING_RESPONSE_ACTIONS_HISTORY_PATH);
componentToRender = shouldUseMissingPrivilegesScreen
? () => <NoPrivilegesPage />
? () => <NoPrivilegesPage documentationUrl={docLinks.links.securitySolution.privileges} />
: NoPermissions;
}