mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Enterprise Search] Warn about Kibana access when adding single user role mappings (#114567)
* Warn about Kibana access when adding single user role mappings to Enterprise Search * i18n and sentence case for the Kibana access warning title
This commit is contained in:
parent
8e72e17648
commit
6cb91c472d
6 changed files with 118 additions and 3 deletions
|
@ -69,6 +69,7 @@ export const User: React.FC = () => {
|
|||
username={singleUserRoleMapping.elasticsearchUser.username}
|
||||
email={singleUserRoleMapping.elasticsearchUser.email as string}
|
||||
roleType={singleUserRoleMapping.roleMapping.roleType}
|
||||
showKibanaAccessWarning={!singleUserRoleMapping.hasEnterpriseSearchRole}
|
||||
/>
|
||||
);
|
||||
|
||||
|
|
|
@ -448,3 +448,25 @@ export const SMTP_CALLOUT_LABEL = i18n.translate(
|
|||
export const SMTP_LINK_LABEL = i18n.translate('xpack.enterpriseSearch.roleMapping.smtpLinkLabel', {
|
||||
defaultMessage: 'SMTP configuration is provided',
|
||||
});
|
||||
|
||||
export const KIBANA_ACCESS_WARNING_TITLE = i18n.translate(
|
||||
'xpack.enterpriseSearch.roleMapping.kibanaAccessWarningTitle',
|
||||
{
|
||||
defaultMessage: 'Kibana access warning',
|
||||
}
|
||||
);
|
||||
|
||||
export const KIBANA_ACCESS_WARNING_ERROR_MESSAGE = i18n.translate(
|
||||
'xpack.enterpriseSearch.roleMapping.kibanaAccessWarningErrorMessage',
|
||||
{
|
||||
defaultMessage:
|
||||
'This Elasticsearch user does not have an Enterprise Search role in Elasticsearch. They may not have access to Kibana.',
|
||||
}
|
||||
);
|
||||
|
||||
export const KIBANA_ACCESS_WARNING_DESCRIPTION = i18n.translate(
|
||||
'xpack.enterpriseSearch.roleMapping.kibanaAccessWarningDescription',
|
||||
{
|
||||
defaultMessage: 'Consider giving them the "enterprise-search-user" role.',
|
||||
}
|
||||
);
|
||||
|
|
|
@ -16,6 +16,7 @@ describe('UserAddedInfo', () => {
|
|||
username: 'user1',
|
||||
email: 'test@test.com',
|
||||
roleType: 'user',
|
||||
showKibanaAccessWarning: false,
|
||||
};
|
||||
|
||||
it('renders with email', () => {
|
||||
|
@ -117,4 +118,70 @@ describe('UserAddedInfo', () => {
|
|||
</Fragment>
|
||||
`);
|
||||
});
|
||||
|
||||
it('renders with the Kibana access warning', () => {
|
||||
const wrapper = shallow(<UserAddedInfo {...props} showKibanaAccessWarning />);
|
||||
|
||||
expect(wrapper).toMatchInlineSnapshot(`
|
||||
<Fragment>
|
||||
<EuiCallOut
|
||||
color="warning"
|
||||
iconType="help"
|
||||
title="Kibana access warning"
|
||||
>
|
||||
<EuiText
|
||||
size="s"
|
||||
>
|
||||
This Elasticsearch user does not have an Enterprise Search role in Elasticsearch. They may not have access to Kibana.
|
||||
</EuiText>
|
||||
<EuiSpacer />
|
||||
<EuiText
|
||||
size="s"
|
||||
>
|
||||
Consider giving them the "enterprise-search-user" role.
|
||||
</EuiText>
|
||||
</EuiCallOut>
|
||||
<EuiSpacer />
|
||||
<EuiText
|
||||
size="s"
|
||||
>
|
||||
<strong>
|
||||
Username
|
||||
</strong>
|
||||
</EuiText>
|
||||
<EuiText
|
||||
size="s"
|
||||
>
|
||||
user1
|
||||
</EuiText>
|
||||
<EuiSpacer />
|
||||
<EuiText
|
||||
size="s"
|
||||
>
|
||||
<strong>
|
||||
Email
|
||||
</strong>
|
||||
</EuiText>
|
||||
<EuiText
|
||||
size="s"
|
||||
>
|
||||
test@test.com
|
||||
</EuiText>
|
||||
<EuiSpacer />
|
||||
<EuiText
|
||||
size="s"
|
||||
>
|
||||
<strong>
|
||||
Role
|
||||
</strong>
|
||||
</EuiText>
|
||||
<EuiText
|
||||
size="s"
|
||||
>
|
||||
user
|
||||
</EuiText>
|
||||
<EuiSpacer />
|
||||
</Fragment>
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,22 +7,45 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
import { EuiSpacer, EuiText, EuiTextColor } from '@elastic/eui';
|
||||
import { EuiCallOut, EuiSpacer, EuiText, EuiTextColor } from '@elastic/eui';
|
||||
|
||||
import { USERNAME_LABEL, EMAIL_LABEL } from '../constants';
|
||||
|
||||
import { ROLE_LABEL } from './constants';
|
||||
import {
|
||||
KIBANA_ACCESS_WARNING_TITLE,
|
||||
KIBANA_ACCESS_WARNING_DESCRIPTION,
|
||||
KIBANA_ACCESS_WARNING_ERROR_MESSAGE,
|
||||
ROLE_LABEL,
|
||||
} from './constants';
|
||||
|
||||
interface Props {
|
||||
username: string;
|
||||
email: string;
|
||||
roleType: string;
|
||||
showKibanaAccessWarning: boolean;
|
||||
}
|
||||
|
||||
const kibanaAccessWarning = (
|
||||
<>
|
||||
<EuiCallOut title={KIBANA_ACCESS_WARNING_TITLE} color="warning" iconType="help">
|
||||
<EuiText size="s">{KIBANA_ACCESS_WARNING_ERROR_MESSAGE}</EuiText>
|
||||
<EuiSpacer />
|
||||
<EuiText size="s">{KIBANA_ACCESS_WARNING_DESCRIPTION}</EuiText>
|
||||
</EuiCallOut>
|
||||
<EuiSpacer />
|
||||
</>
|
||||
);
|
||||
|
||||
const noItemsPlaceholder = <EuiTextColor color="subdued">—</EuiTextColor>;
|
||||
|
||||
export const UserAddedInfo: React.FC<Props> = ({ username, email, roleType }) => (
|
||||
export const UserAddedInfo: React.FC<Props> = ({
|
||||
username,
|
||||
email,
|
||||
roleType,
|
||||
showKibanaAccessWarning,
|
||||
}) => (
|
||||
<>
|
||||
{showKibanaAccessWarning && kibanaAccessWarning}
|
||||
<EuiText size="s">
|
||||
<strong>{USERNAME_LABEL}</strong>
|
||||
</EuiText>
|
||||
|
|
|
@ -55,4 +55,5 @@ export interface SingleUserRoleMapping<T> {
|
|||
invitation: Invitation | null;
|
||||
elasticsearchUser: ElasticsearchUser;
|
||||
roleMapping: T;
|
||||
hasEnterpriseSearchRole?: boolean;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ export const User: React.FC = () => {
|
|||
username={singleUserRoleMapping.elasticsearchUser.username}
|
||||
email={singleUserRoleMapping.elasticsearchUser.email as string}
|
||||
roleType={singleUserRoleMapping.roleMapping.roleType}
|
||||
showKibanaAccessWarning={!singleUserRoleMapping.hasEnterpriseSearchRole}
|
||||
/>
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue