diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/delete_role_button.js b/x-pack/plugins/security/public/views/management/edit_role/components/delete_role_button.js
index 805dfb232fff4..347ea6c454d73 100644
--- a/x-pack/plugins/security/public/views/management/edit_role/components/delete_role_button.js
+++ b/x-pack/plugins/security/public/views/management/edit_role/components/delete_role_button.js
@@ -7,7 +7,7 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import {
- EuiButton,
+ EuiButtonEmpty,
EuiOverlayMask,
EuiConfirmModal,
} from '@elastic/eui';
@@ -29,9 +29,9 @@ export class DeleteRoleButton extends Component {
return (
-
- Delete Role
-
+
+ Delete role
+
{this.maybeShowModal()}
);
diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/edit_role_page.js b/x-pack/plugins/security/public/views/management/edit_role/components/edit_role_page.js
index 5eb5c8f973341..dd599955e39c3 100644
--- a/x-pack/plugins/security/public/views/management/edit_role/components/edit_role_page.js
+++ b/x-pack/plugins/security/public/views/management/edit_role/components/edit_role_page.js
@@ -19,6 +19,7 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiButton,
+ EuiPageBody,
} from '@elastic/eui';
import { saveRole, deleteRole } from '../../../../objects';
import { isReservedRole } from '../../../../lib/role';
@@ -53,22 +54,24 @@ export class EditRolePage extends Component {
render() {
return (
-
-
- {this.getFormTitle()}
+
+
+
+ {this.getFormTitle()}
-
+
- {this.getRoleName()}
+ {this.getRoleName()}
- {this.getElasticsearchPrivileges()}
+ {this.getElasticsearchPrivileges()}
- {this.getKibanaPrivileges()}
+ {this.getKibanaPrivileges()}
-
+
- {this.getFormButtons()}
-
+ {this.getFormButtons()}
+
+
);
}
diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_callout_warning.js b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_callout_warning.js
index 9e63d4ba35d02..2a305b4016984 100644
--- a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_callout_warning.js
+++ b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_callout_warning.js
@@ -3,30 +3,60 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-import React, { Fragment } from 'react';
+import React from 'react';
import PropTypes from 'prop-types';
import {
EuiCallOut
} from '@elastic/eui';
+import { NO_PRIVILEGE_VALUE } from '../../../lib/constants';
export const PrivilegeCalloutWarning = ({ basePrivilege, isReservedRole }) => {
if (basePrivilege === 'all') {
- return (
-
-
- Setting the minimum privilege to all grants full access to all spaces.
- {getCorrectiveActionText(basePrivilege, isReservedRole)}
-
-
- );
+ if (isReservedRole) {
+ return (
+
+
+ This role always grants full access to all spaces.
+ To customize privileges for individual spaces, you must create a new role.
+
+
+ );
+ } else {
+ return (
+
+
+ Setting the minimum privilege to all grants full access to all spaces.
+ To customize privileges for individual spaces,
+ the minimum privilege must be either read or none.
+
+
+ );
+ }
}
if (basePrivilege === 'read') {
+ if (isReservedRole) {
+ return (
+
+
+ This role always grants read access to all spaces.
+ To customize privileges for individual spaces, you must create a new role.
+
+
+ );
+ } else {
+ return (
+
+ );
+ }
+ }
+
+ if (basePrivilege === NO_PRIVILEGE_VALUE && isReservedRole) {
return (
-
+
- Setting the minimum privilege to read grants a minimum of read access to all spaces.
- {getCorrectiveActionText(basePrivilege, isReservedRole)}
+ This role never grants access to any spaces within Kibana.
+ To customize privileges for individual spaces, you must create a new role.
);
@@ -35,37 +65,6 @@ export const PrivilegeCalloutWarning = ({ basePrivilege, isReservedRole }) => {
return null;
};
-function getCorrectiveActionText(basePrivilege, isReservedRole) {
- if (basePrivilege === 'all') {
- return isReservedRole
- ? (
-
- To customize privileges for individual spaces, create a new role,
- and set the minimum privilege to either read or none
-
- )
- : (
-
- To customize privileges for individual spaces, set the minimum privilege to either read or none
-
- );
- }
- if (basePrivilege === 'read') {
- return isReservedRole
- ? (
-
- To restrict access to individual spaces, create a new role,
- and set the minimum privilege to none
-
- )
- : (
-
- To restrict access to individual spaces, set the minimum privilege to none
-
- );
- }
-}
-
PrivilegeCalloutWarning.propTypes = {
basePrivilege: PropTypes.string.isRequired,
isReservedRole: PropTypes.bool.isRequired,
diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_selector.js b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_selector.js
index dee4e6b0fdf7b..5571f86db2d9e 100644
--- a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_selector.js
+++ b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_selector.js
@@ -19,6 +19,7 @@ export class PrivilegeSelector extends Component {
value: PropTypes.string,
allowNone: PropTypes.bool,
disabled: PropTypes.bool,
+ compressed: PropTypes.bool,
};
state = {}
@@ -29,6 +30,7 @@ export class PrivilegeSelector extends Component {
value,
disabled,
allowNone,
+ compressed,
} = this.props;
const options = [];
@@ -48,6 +50,7 @@ export class PrivilegeSelector extends Component {
value={value || ''}
onChange={this.onChange}
disabled={disabled}
+ compressed={compressed}
/>
);
}
diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_space_table.js b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_space_table.js
index 5d5e9d13df473..f559905b7d822 100644
--- a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_space_table.js
+++ b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/privilege_space_table.js
@@ -39,13 +39,14 @@ export class PrivilegeSpaceTable extends Component {
return (
(
-
-
+
+
{space.name}
)
@@ -59,6 +60,7 @@ export class PrivilegeSpaceTable extends Component {
value={privilege}
disabled={isReservedRole(role)}
onChange={this.onSpacePermissionChange(record)}
+ compressed
/>
);
}
diff --git a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_form.js b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_form.js
index dcb5384bdf7b8..e98a22585569c 100644
--- a/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_form.js
+++ b/x-pack/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_form.js
@@ -16,7 +16,6 @@ import {
EuiButton,
EuiText,
EuiTitle,
- EuiHorizontalRule,
} from '@elastic/eui';
import { isReservedRole } from '../../../../../../lib/role';
import { copyRole } from '../../../lib/copy_role';
@@ -64,13 +63,27 @@ export class SpaceAwarePrivilegeForm extends Component {
const basePrivilege = assignedPrivileges[ALL_RESOURCE].length > 0 ? assignedPrivileges[ALL_RESOURCE][0] : NO_PRIVILEGE_VALUE;
+ const description = (Specifies the lowest permission level for all spaces, unless a custom privilege is specified.
);
+
+ let helptext;
+ if (basePrivilege === NO_PRIVILEGE_VALUE) {
+ helptext = "No access";
+ } else if (basePrivilege === 'all') {
+ helptext = "View, edit, and share all objects and apps within all spaces";
+ } else if (basePrivilege === 'read') {
+ helptext = "View only mode";
+ }
+
return (
Minimum privilege
}
- description={Specifies the lowest permission level for all spaces.
}
+ title={Minimum privilege
}
+ description={description}
>
-
+
+
{this.renderSpacePrivileges(basePrivilege, availablePrivileges)}
);
}
renderSpacePrivileges = (basePrivilege, availablePrivileges) => {
- if (basePrivilege === 'all') {
- return ;
- }
-
const {
role,
spaces,
@@ -107,21 +117,24 @@ export class SpaceAwarePrivilegeForm extends Component {
Space privileges
-
+
- Customize permission levels on a per space basis.
- If a space is not listed, its permissions will default to the minimum privilege specified above.
+ Customize permission levels per space.
+ If a space is not customized, its permissions will default to the minimum privilege specified above.
+ {basePrivilege !== 'all' && this.props.editable && (
+ You can bulk-create space privileges though they will be saved individually upon saving the role.
+ )}
- {
- basePrivilege === 'read'
- && (this.state.privilegeForms.length > 0 || Object.keys(this.state.spacePrivileges).length > 0)
- &&
+ {(basePrivilege !== NO_PRIVILEGE_VALUE || isReservedRole(this.props.role)) &&
+
}
-
-
+ {basePrivilege === 'read' && this.props.editable &&
}
+
+ {basePrivilege !== 'all' && (
+
+ {(Object.keys(this.state.spacePrivileges).length > 0) && }
+
{this.props.editable && (
{this.state.privilegeForms.map((form, index) => this.getSpaceForm(form, index, basePrivilege))}
{availableSpaces.length > 0 &&
-
-
- Add space privilege
-
+ Add space privilege
}
)}
-
-
-
+
+ )}
);
}
@@ -189,13 +200,8 @@ export class SpaceAwarePrivilegeForm extends Component {
const availableSpaces = this.getAvailableSpaces(index);
- const isFirst = index === 0;
-
- const startingElement = isFirst ? : ;
-
return (
-
- {startingElement}
+
+
);
}
diff --git a/x-pack/plugins/security/public/views/management/edit_role/edit_role.less b/x-pack/plugins/security/public/views/management/edit_role/edit_role.less
index d4f7ac04880d6..b3b4212bb1f1a 100644
--- a/x-pack/plugins/security/public/views/management/edit_role/edit_role.less
+++ b/x-pack/plugins/security/public/views/management/edit_role/edit_role.less
@@ -1,10 +1,4 @@
#editRoleReactRoot {
background: #f5f5f5;
- flex-grow: 1;
-}
-
-.editRolePage {
- max-width: 1000px;
- margin-left: auto;
- margin-right: auto;
+ min-height: ~"calc(100vh - 70px)";
}