Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spaces] Updates to Spaces UIs, allow assign roles to Space #184697

Closed
wants to merge 174 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
7730412
New Security Management page: View Space
tsullivan May 24, 2024
827c2b0
Content counts link to saved objects page
tsullivan Jun 3, 2024
3062995
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jun 4, 2024
a3af1d8
link to content working
tsullivan Jun 4, 2024
8261854
Polish features tab
tsullivan Jun 4, 2024
250b983
Loading states
tsullivan Jun 4, 2024
90862b1
minor copy update to features tab
tsullivan Jun 4, 2024
08b197e
use encodeURIComponent in params of href when navigating to content
tsullivan Jun 5, 2024
b75b6ae
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jun 6, 2024
bb657e9
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jun 7, 2024
e433101
[wip] callout for current space
tsullivan Jun 7, 2024
509479f
Feature table: optional header text
tsullivan Jun 7, 2024
2cacaa3
Feature table: dynamic “show all” / “hide all”
tsullivan Jun 7, 2024
59ac384
Enabled Features tab header text update
tsullivan Jun 7, 2024
1c49338
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jun 7, 2024
e968986
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jun 7, 2024
6121659
display switch to space only when space is not active space
eokoneyo Jun 3, 2024
7f90e7f
swap hardcoded strings for translated ones
eokoneyo Jun 4, 2024
35a37e9
add ftr test for space details and space switching
eokoneyo Jun 4, 2024
83f5dad
fix failing test
eokoneyo Jun 10, 2024
dd25dd2
add switch to space icon on space list table
eokoneyo Jun 13, 2024
eb6497b
visual tweak for role creation page
eokoneyo Jun 13, 2024
31635b7
start work on assign to role flyout
eokoneyo Jun 13, 2024
e844219
Merge pull request #11 from eokoneyo/tsullivan-roles-spaces-modal
tsullivan Jun 17, 2024
d3cf527
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jun 17, 2024
c165690
fix i18n
tsullivan Jun 17, 2024
a0e4b4b
fix ts
tsullivan Jun 17, 2024
d926a01
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jun 19, 2024
b711c46
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jun 21, 2024
d3d6eec
Truncate description in spaces grid page
tsullivan Jun 21, 2024
3b9b113
Use subdued badge color in tabs
tsullivan Jun 21, 2024
7639092
Update spaces grid for multiple actions
tsullivan Jun 21, 2024
581b59f
Keep user on spaces grid page when they switch to space from there
tsullivan Jun 21, 2024
bc79e01
fix i18n error
tsullivan Jun 21, 2024
3afa207
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jun 21, 2024
6a64fa6
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 1, 2024
e7ae2f2
add fixme props
tsullivan Jul 1, 2024
532a0cc
fix ts
tsullivan Jul 1, 2024
7079146
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 1, 2024
4341bf2
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 3, 2024
c7ea1bb
Current space badge for space detail header
tsullivan Jul 3, 2024
ac40e06
Show selected solution in space detail
tsullivan Jul 3, 2024
fed1c85
Cleanup
tsullivan Jul 3, 2024
5b89ead
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 8, 2024
2a16ec9
Minor feedback updates
tsullivan Jul 8, 2024
19dd7ff
Make action icons for the space consistent
tsullivan Jul 8, 2024
6e00210
include roleAPIClient
eokoneyo Jul 2, 2024
fa0a086
conditionally render role action based on user capabilities
eokoneyo Jul 2, 2024
fbfa5c2
start on assigning space to selected roles
eokoneyo Jul 2, 2024
b92d1e5
switch to leveraging predefined privilege
eokoneyo Jul 3, 2024
e5f24ac
Design feedback
eokoneyo Jul 9, 2024
825be30
Merge pull request #13 from eokoneyo/feat/assigning-roles-to-space
tsullivan Jul 9, 2024
26f20e3
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 9, 2024
2505f3d
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 12, 2024
07b4e5b
fix jest test
tsullivan Jul 12, 2024
12995c1
fix fn test
tsullivan Jul 12, 2024
16eb2a6
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 16, 2024
43dc4f8
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 17, 2024
5f851b3
File rename
tsullivan Jul 17, 2024
0d227e5
Replace Omit with Pick
tsullivan Jul 18, 2024
879832e
Add General tab
tsullivan Jul 18, 2024
af8121b
Add Solution View to features tab
tsullivan Jul 18, 2024
ce101fc
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 18, 2024
83c0a91
fix solution view in features tab
tsullivan Jul 18, 2024
b9c8ff0
Clean up args
tsullivan Jul 18, 2024
17a66ef
Avoid `useKibana`
tsullivan Jul 18, 2024
5243f1b
Wip - make editable
tsullivan Jul 18, 2024
bf244d4
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 22, 2024
278dee4
Fix ts in Roles
tsullivan Jul 22, 2024
5e064f7
Unsaved changes prompt
tsullivan Jul 22, 2024
1cc5125
quick checks and consistency
tsullivan Jul 22, 2024
79afa3a
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jul 22, 2024
fb221eb
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 23, 2024
9666bd4
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 24, 2024
0f2c78c
Optional title for SectionPanel to lessen headers for View Space tabs
tsullivan Jul 24, 2024
dbdbaa5
Handle allowFeatureVisibility
tsullivan Jul 24, 2024
cc06372
Implement save space features and space settings
tsullivan Jul 25, 2024
95a54ac
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 26, 2024
99802b0
Use new UI for Edit link
tsullivan Jul 26, 2024
cae0793
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 29, 2024
abddade
--wip-- [skip ci]
tsullivan Jul 29, 2024
e7a2c96
Footer controls
tsullivan Jul 30, 2024
e4dbc1e
Merge branch 'main' into roles/details/spaces-modal
tsullivan Jul 30, 2024
aa27b32
Remove Settings button
tsullivan Jul 30, 2024
b8b1b52
wip: assign roles from create form
tsullivan Jul 30, 2024
0977eb7
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 1, 2024
d7f96e0
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 2, 2024
1269674
fix unit test
tsullivan Aug 2, 2024
0f3d01b
Remove features column from table for non-classic
tsullivan Aug 2, 2024
adaea5f
Move features table to settings tab for non-classic
tsullivan Aug 2, 2024
2d4ec56
fix unit test
tsullivan Aug 2, 2024
67146fb
show space badge if non-classic
tsullivan Aug 2, 2024
3f81a07
Merge branch 'roles/details/spaces-modal' of github.com:tsullivan/kib…
tsullivan Aug 2, 2024
54028cf
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 5, 2024
1211142
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 5, 2024
e53ce6d
fix functional test
tsullivan Aug 5, 2024
ad8c702
wip fix functional tests for new tab design
tsullivan Aug 5, 2024
2465325
wip fix functional tests for new tab design
tsullivan Aug 5, 2024
60d79cf
update user impact warning
tsullivan Aug 5, 2024
02d82f1
Merge branch 'roles/details/spaces-modal' of github.com:tsullivan/kib…
tsullivan Aug 5, 2024
f3224c8
Fix edit space confirm modals
tsullivan Aug 5, 2024
4d013a4
Fix functional tests
tsullivan Aug 5, 2024
78a07e5
skip failing tests
tsullivan Aug 6, 2024
c9eebea
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 6, 2024
801a52c
Fix update avatar initials
tsullivan Aug 6, 2024
2c70b05
Apply notifications when save or cancel
tsullivan Aug 6, 2024
f2cae83
fix font size for "No features visible"
tsullivan Aug 6, 2024
80d4188
handle error when user has no privilege to view roles
tsullivan Aug 6, 2024
22b9840
fix fn tests
tsullivan Aug 6, 2024
c19c560
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 9, 2024
fbec082
Clean up unused prop
tsullivan Aug 9, 2024
d3abbe1
Remove stray WIP
tsullivan Aug 9, 2024
04f1cb5
lazy load tab content
tsullivan Aug 9, 2024
e732902
Fix delete space
tsullivan Aug 9, 2024
0fd7a06
consolidate ftr tests for listing of spaces
tsullivan Aug 9, 2024
2ebb3f6
start ftr test for create space
tsullivan Aug 10, 2024
ccddaaf
Test for editing space initials
tsullivan Aug 14, 2024
5a71687
functional tests cleanup
tsullivan Aug 15, 2024
f2d6da4
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 15, 2024
eb4a5f5
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 15, 2024
24c014b
fix i18n check
tsullivan Aug 16, 2024
d7f9a71
Show/hide feature visibility picker
tsullivan Aug 16, 2024
31149f3
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 19, 2024
2cb78c7
Correction for solution visibility / feature visibility
tsullivan Aug 19, 2024
ec6b2f9
fix tests
tsullivan Aug 19, 2024
454e357
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 20, 2024
5f82465
Memoize functions that are passed as props to child components
tsullivan Aug 21, 2024
73bf1b6
todos
tsullivan Aug 22, 2024
8d4838a
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 22, 2024
c53c6d5
Unit test for General Settings tab
tsullivan Aug 22, 2024
273fdc8
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 23, 2024
24034b3
Update comments
tsullivan Aug 23, 2024
986e8f5
More unit test for General Settings tab
tsullivan Aug 23, 2024
8052507
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 26, 2024
19a81bc
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 26, 2024
f69154e
Merge branch 'main' into roles/details/spaces-modal
elasticmachine Aug 27, 2024
1bf9623
Merge branch 'roles/details/spaces-modal' of github.com:tsullivan/kib…
tsullivan Aug 27, 2024
3f4c279
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 27, 2024
ae18346
[Spaces] Manage Space: features picker is shown only when solution is…
tsullivan Aug 27, 2024
2338e06
create spaces assigned role table
eokoneyo Jul 23, 2024
8872a5d
extend definition of roles that can be edited
eokoneyo Jul 26, 2024
bb69ad5
fix pluralization in select all button
eokoneyo Jul 26, 2024
73a0dd1
slight adjustments rendered items count
eokoneyo Jul 26, 2024
88a2c2d
fix text, and hide assign to space button when there are roles to assign
eokoneyo Jul 31, 2024
4b76e01
integrate security packages
eokoneyo Aug 1, 2024
9cbf1ec
add tests for provisioning privilege API client
eokoneyo Aug 2, 2024
8f2f38d
even more UI improvements
eokoneyo Aug 12, 2024
1bc6528
refactor trigger for flyout and integrate it with bulk actions
eokoneyo Aug 13, 2024
63035a7
make accomodation for edit existing record
eokoneyo Aug 13, 2024
9541fc4
integrate API to update roles, leverage this to update existing space…
eokoneyo Aug 13, 2024
ee5e218
add logic to handle removing roles from space
eokoneyo Aug 14, 2024
c13613e
refactor implementation to provide visual feedback on UI actions
eokoneyo Aug 15, 2024
a50eade
fix logic for excluding roles already ppart of space
eokoneyo Aug 15, 2024
ad1e526
fix logic with selectable items
eokoneyo Aug 15, 2024
f51800b
add implementation for assigning custom roles privileges
eokoneyo Aug 15, 2024
8be8076
refactor logic for selecting role cutomization anchor
eokoneyo Aug 19, 2024
e91dff4
UI cleanup
eokoneyo Aug 21, 2024
1b7d516
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 23, 2024
7f5cff9
fix failing tests
eokoneyo Aug 26, 2024
27b1428
UI tweaks
eokoneyo Aug 26, 2024
3fb9d8e
add tests for view space provider
eokoneyo Aug 26, 2024
f18eba3
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Aug 27, 2024
d29d066
add tests for space assign role privilege form
eokoneyo Aug 26, 2024
7579ac5
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Aug 27, 2024
18c0d83
pass appropriate types to component
eokoneyo Aug 27, 2024
ccd34f3
Merge pull request #14 from eokoneyo/assign-roles-to-space
tsullivan Aug 28, 2024
1eaa880
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 28, 2024
699088d
remove the EuiText that surrounds the view-space-page
tsullivan Aug 28, 2024
70fb39f
--wip-- [skip ci]
tsullivan Aug 29, 2024
9a8320d
Merge branch 'main' into roles/details/spaces-modal
tsullivan Aug 29, 2024
cfb7972
fix ts
tsullivan Aug 29, 2024
467bea8
file/folder reorg
tsullivan Aug 29, 2024
acae0c5
file/folder reorg
tsullivan Aug 29, 2024
38a85b0
Merge branch 'roles/details/spaces-modal' of github.com:tsullivan/kib…
tsullivan Aug 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface PrivilegesAPIClientGetAllArgs {
*/
respectLicenseLevel: boolean;
}
// TODO: Eyo include the proper return types for contract

export abstract class PrivilegesAPIClientPublicContract {
abstract getAll(args: PrivilegesAPIClientGetAllArgs): Promise<RawKibanaPrivileges>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export interface RolesAPIClient {
getRole: (roleName: string) => Promise<Role>;
deleteRole: (roleName: string) => Promise<void>;
saveRole: (payload: RolePutPayload) => Promise<void>;
bulkUpdateRoles: (payload: { rolesUpdate: Role[] }) => Promise<void>;
}
2 changes: 1 addition & 1 deletion x-pack/packages/security/plugin_types_public/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@kbn/core-user-profile-common",
"@kbn/security-plugin-types-common",
"@kbn/core-security-common",
"@kbn/security-authorization-core"
"@kbn/security-authorization-core",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import {
kibanaFeatures,
} from '@kbn/security-role-management-model/src/__fixtures__';
import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers';
import type { Role } from '@kbn/security-plugin-types-common';

import { getDisplayedFeaturePrivileges } from './__fixtures__';
import { FeatureTable } from './feature_table';
import type { Role } from '@kbn/security-plugin-types-common';
import { PrivilegeFormCalculator } from '../privilege_form_calculator';

const createRole = (kibana: Role['kibana'] = []): Role => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import {
createKibanaPrivileges,
kibanaFeatures,
} from '@kbn/security-role-management-model/src/__fixtures__';
import type { Role } from '@kbn/security-plugin-types-common';
import { findTestSubject, mountWithIntl } from '@kbn/test-jest-helpers';

import { FeatureTableExpandedRow } from './feature_table_expanded_row';
import type { Role } from '@kbn/security-plugin-types-common';
import { PrivilegeFormCalculator } from '../privilege_form_calculator';

const createRole = (kibana: Role['kibana'] = []): Role => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import type {
SubFeaturePrivilege,
SubFeaturePrivilegeGroup,
} from '@kbn/security-role-management-model';

import { NO_PRIVILEGE_VALUE } from '../constants';
import type { PrivilegeFormCalculator } from '../privilege_form_calculator';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
createKibanaPrivileges,
kibanaFeatures,
} from '@kbn/security-role-management-model/src/__fixtures__';
import type { Role } from '@kbn/security-plugin-types-common';

import { PrivilegeFormCalculator } from './privilege_form_calculator';
import type { Role } from '@kbn/security-plugin-types-common';

const createRole = (kibana: Role['kibana'] = []): Role => {
return {
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/security/public/authentication/index.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const authorizationMock = {
getRole: jest.fn(),
deleteRole: jest.fn(),
saveRole: jest.fn(),
bulkUpdateRoles: jest.fn(),
},
privileges: {
getAll: jest.fn(),
Expand All @@ -43,6 +44,7 @@ export const authorizationMock = {
getRole: jest.fn(),
deleteRole: jest.fn(),
saveRole: jest.fn(),
bulkUpdateRoles: jest.fn(),
},
privileges: {
getAll: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class AuthorizationService {
getRole: rolesAPIClient.getRole,
deleteRole: rolesAPIClient.deleteRole,
saveRole: rolesAPIClient.saveRole,
bulkUpdateRoles: rolesAPIClient.bulkUpdateRoles,
},
privileges: {
getAll: privilegesAPIClient.getAll.bind(privilegesAPIClient),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
EuiFlexItem,
EuiForm,
EuiFormRow,
EuiIconTip,
EuiPanel,
EuiSpacer,
EuiText,
Expand Down Expand Up @@ -555,52 +556,46 @@ export const EditRolePage: FunctionComponent<Props> = ({

const getElasticsearchPrivileges = () => {
return (
<div>
<EuiSpacer />
<ElasticsearchPrivileges
role={role}
editable={!isRoleReadOnly}
indicesAPIClient={indicesAPIClient}
onChange={onRoleChange}
runAsUsers={runAsUsers}
validator={validator}
indexPatterns={indexPatternsTitles}
remoteClusters={remoteClustersState.value}
builtinESPrivileges={builtInESPrivileges}
license={license}
docLinks={docLinks}
canUseRemoteIndices={
buildFlavor === 'traditional' && featureCheckState.value?.canUseRemoteIndices
}
canUseRemoteClusters={
buildFlavor === 'traditional' && featureCheckState.value?.canUseRemoteClusters
}
isDarkMode={isDarkMode}
buildFlavor={buildFlavor}
/>
</div>
<ElasticsearchPrivileges
role={role}
editable={!isRoleReadOnly}
indicesAPIClient={indicesAPIClient}
onChange={onRoleChange}
runAsUsers={runAsUsers}
validator={validator}
indexPatterns={indexPatternsTitles}
remoteClusters={remoteClustersState.value}
builtinESPrivileges={builtInESPrivileges}
license={license}
docLinks={docLinks}
canUseRemoteIndices={
buildFlavor === 'traditional' && featureCheckState.value?.canUseRemoteIndices
}
canUseRemoteClusters={
buildFlavor === 'traditional' && featureCheckState.value?.canUseRemoteClusters
}
isDarkMode={isDarkMode}
buildFlavor={buildFlavor}
/>
);
};

const onRoleChange = (newRole: Role) => setRole(newRole);

const getKibanaPrivileges = () => {
return (
<div>
<EuiSpacer />
<KibanaPrivilegesRegion
kibanaPrivileges={new KibanaPrivileges(kibanaPrivileges, features)}
spaces={spaces.list}
spacesEnabled={spaces.enabled}
uiCapabilities={uiCapabilities}
canCustomizeSubFeaturePrivileges={license.getFeatures().allowSubFeaturePrivileges}
editable={!isRoleReadOnly}
role={role}
onChange={onRoleChange}
validator={validator}
spacesApiUi={spacesApiUi}
/>
</div>
<KibanaPrivilegesRegion
kibanaPrivileges={new KibanaPrivileges(kibanaPrivileges, features)}
spaces={spaces.list}
spacesEnabled={spaces.enabled}
uiCapabilities={uiCapabilities}
canCustomizeSubFeaturePrivileges={license.getFeatures().allowSubFeaturePrivileges}
editable={!isRoleReadOnly}
role={role}
onChange={onRoleChange}
validator={validator}
spacesApiUi={spacesApiUi}
/>
);
};

Expand Down Expand Up @@ -799,44 +794,89 @@ export const EditRolePage: FunctionComponent<Props> = ({

return (
<div className="editRolePage">
<EuiForm {...formError}>
{getFormTitle()}
<EuiSpacer />
<EuiText size="s">
<FormattedMessage
id="xpack.security.management.editRole.setPrivilegesToKibanaSpacesDescription"
defaultMessage="Set privileges on your Elasticsearch data and control access to your Project spaces."
/>
</EuiText>
{isRoleReserved && (
<Fragment>
<EuiSpacer size="s" />
<EuiText size="s" color="subdued">
<p id="reservedRoleDescription" tabIndex={0}>
<EuiForm {...formError} fullWidth>
<EuiFlexGroup direction="column">
<EuiFlexItem>
{getFormTitle()}
<EuiSpacer />
<EuiText size="s">
<FormattedMessage
id="xpack.security.management.editRole.setPrivilegesToKibanaSpacesDescription"
defaultMessage="Set privileges on your Elasticsearch data and control access to your Project spaces."
/>
</EuiText>
</EuiFlexItem>
<EuiFlexItem>
{isRoleReserved && (
<Fragment>
<EuiText size="s" color="subdued">
<p id="reservedRoleDescription" tabIndex={0}>
<FormattedMessage
id="xpack.security.management.editRole.modifyingReversedRolesDescription"
defaultMessage="Reserved roles are built-in and cannot be removed or modified."
/>
</p>
</EuiText>
</Fragment>
)}
</EuiFlexItem>
<EuiFlexItem>
{isDeprecatedRole && (
<Fragment>
<EuiSpacer size="s" />
<EuiCallOut
title={getExtendedRoleDeprecationNotice(role)}
color="warning"
iconType="warning"
/>
</Fragment>
)}
</EuiFlexItem>
<EuiFlexItem>{getRoleNameAndDescription()}</EuiFlexItem>
<EuiFlexItem>
<EuiFormRow
label={
<FormattedMessage
id="xpack.security.management.editRole.modifyingReversedRolesDescription"
defaultMessage="Reserved roles are built-in and cannot be removed or modified."
id="xpack.security.management.editRole.dataLayerLabel"
defaultMessage="Data Layer"
/>
</p>
</EuiText>
</Fragment>
)}
{isDeprecatedRole && (
<Fragment>
<EuiSpacer size="s" />
<EuiCallOut
title={getExtendedRoleDeprecationNotice(role)}
color="warning"
iconType="warning"
/>
</Fragment>
)}
<EuiSpacer />
{getRoleNameAndDescription()}
{getElasticsearchPrivileges()}
{getKibanaPrivileges()}
<EuiSpacer />
{getFormButtons()}
}
>
{getElasticsearchPrivileges()}
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem>
<EuiFormRow
label={
<EuiFlexGroup gutterSize="s" alignItems="center" responsive={false}>
<EuiFlexItem grow={false}>
<FormattedMessage
id="xpack.security.management.editRole.appLayerLabel"
defaultMessage="Application layer"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiIconTip
type="iInCircle"
color="subdued"
content={
<FormattedMessage
id="xpack.security.management.editRole.appLayerTooltipText"
defaultMessage="Feature access is granted on a per space basis for all features. Feature visibility is set on the space. Both must be enabled for this role to use a feature"
/>
}
/>
</EuiFlexItem>
</EuiFlexGroup>
}
>
{getKibanaPrivileges()}
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem>
<EuiFormRow fullWidth={false}>{getFormButtons()}</EuiFormRow>
</EuiFlexItem>
</EuiFlexGroup>
</EuiForm>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,18 @@ export class PrivilegeSpaceForm extends Component<Props, State> {
<h2>
<FormattedMessage
id="xpack.security.management.editRole.spacePrivilegeForm.modalTitle"
defaultMessage="Kibana privileges"
defaultMessage="Assign role to space"
/>
</h2>
</EuiTitle>
<EuiText size="s">
<p>
<FormattedMessage
id="xpack.security.management.editRole.spacePrivilegeForm.modalHeadline"
defaultMessage="This role will be granted access to the following spaces"
/>
</p>
</EuiText>
</EuiFlyoutHeader>
<EuiFlyoutBody>
<EuiErrorBoundary>{this.getForm()}</EuiErrorBoundary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class SpaceAwarePrivilegeSection extends Component<Props, State> {
>
<FormattedMessage
id="xpack.security.management.editRole.spacePrivilegeSection.addSpacePrivilegeButton"
defaultMessage="Add Kibana privilege"
defaultMessage="Assign to space"
/>
</EuiButton>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export const rolesAPIClientMock = {
getRole: jest.fn(),
deleteRole: jest.fn(),
saveRole: jest.fn(),
bulkUpdateRoles: jest.fn(),
}),
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ export class RolesAPIClient {
});
};

public bulkUpdateRoles = async ({ rolesUpdate }: { rolesUpdate: Role[] }) => {
await this.http.post('/api/security/roles', {
body: JSON.stringify({
roles: rolesUpdate.reduce((transformed, value) => {
transformed[value.name] = this.transformRoleForSave(copyRole(value));
return transformed;
}, {} as Record<string, ReturnType<typeof this.transformRoleForSave>>),
}),
});
};

private transformRoleForSave = (role: Role) => {
// Remove any placeholder index privileges
const isPlaceholderPrivilege = (
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/security/public/plugin.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ describe('Security Plugin', () => {
"getAll": [Function],
},
"roles": Object {
"bulkUpdateRoles": [Function],
"deleteRole": [Function],
"getRole": [Function],
"getRoles": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import type { EnabledFeatures } from '@kbn/spaces-plugin/public/management/edit_space/enabled_features';
import type { EnabledFeatures } from '@kbn/spaces-plugin/public/management/components/enabled_features';
import {
ResponseActionTypes,
ResponseActionTypesEnum,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import { FormattedMessage } from '@kbn/i18n-react';

import { CustomizeSpaceAvatar } from './customize_space_avatar';
import { getSpaceAvatarComponent, getSpaceColor, getSpaceInitials } from '../../../space_avatar';
import type { FormValues } from '../../create_space';
import type { SpaceValidator } from '../../lib';
import { toSpaceIdentifier } from '../../lib';
import type { FormValues } from '../manage_space_page';
import { SectionPanel } from '../section_panel';

// No need to wrap LazySpaceAvatar in an error boundary, because it is one of the first chunks loaded when opening Kibana.
Expand Down
Loading