-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[GAP] - Role Management UI #26840
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
[GAP] - Role Management UI #26840
Changes from all commits
4093cfd
850136b
8ffd05c
fb693d9
a589c8a
3f9ccfc
ebabcf1
6bb3698
692ea4d
a026171
c42985e
0611743
d794923
57ded79
1ab090a
852a422
88fcd21
addb22f
121f7e9
83eb4f4
964de15
f9400cf
eb536ba
e7611fe
c8aebb9
5d9fc5e
6db5ae6
469c2e9
7f5a0f8
9371bc8
9fb4304
45aa9a8
fd5fde2
e38db13
24a81cb
2fa3e26
8b7ea95
c3f148c
c13d875
2b45bad
0c037ed
2d18c4b
3448333
38fd39a
83555da
349c7c3
a2890be
6ab0eb4
751fd78
9b43b3d
d16cb20
bd201ac
5ed8a59
4160ad3
c741663
4d69022
d58cf01
5e3e5f3
64186aa
da30068
674a493
a1cb24c
33a4a29
d3149ac
beaa51f
55ebe13
9c92e6a
2a33a13
c8947aa
825c314
9f48caf
eee2311
c8f331c
a0c75a8
e9b06d6
18fd066
edc65a7
f55e819
736d948
0d674b8
4080b70
cb6fdd1
d14aa9b
74ddad3
9544de3
dd12fda
2997870
ca67150
6c93d00
310fdd1
bd01fbe
46d0d7c
9c0c288
7b4d767
8cc0b61
390280d
b2d8703
e205f13
c502eb2
10c217f
e5808ac
b7e35ed
f4586d5
889b022
dd89a49
c3d7bfa
b665230
c09e325
2747374
d67a7b3
73e7fb1
c16ba50
b58b799
f008641
075bd05
a97a745
31b80cf
c991ba4
cb301a2
f42e584
09701a4
834cc96
8eeed58
0c62090
a425023
7a11724
bfc37a9
542cef1
551700e
50b1460
8e87029
3ca6b1f
e61f308
dec7f15
f12aa60
4978eed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| export { Role } from './role'; | ||
| export { FeaturesPrivileges, PrivilegeMap, KibanaPrivilegeSpec } from './kibana_privilege'; | ||
| export { IndexPrivilege } from './index_privilege'; | ||
| export { PrivilegeDefinition } from './privileges/privilege_definition'; | ||
| export { GlobalPrivileges } from './privileges/global_privileges'; | ||
| export { SpacesPrivileges } from './privileges/spaces_privileges'; | ||
| export { FeaturePrivileges, FeaturePrivilegeSet } from './privileges/feature_privileges'; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| interface FeaturePrivilegesMap { | ||
| [featureId: string]: { | ||
| [privilegeId: string]: string[]; | ||
| }; | ||
| } | ||
|
|
||
| export interface FeaturePrivilegeSet { | ||
| [featureId: string]: string[]; | ||
| } | ||
|
|
||
| export class FeaturePrivileges { | ||
| constructor(private readonly featurePrivilegesMap: FeaturePrivilegesMap) {} | ||
|
|
||
| public getAllPrivileges(): FeaturePrivilegeSet { | ||
| return Object.entries(this.featurePrivilegesMap).reduce((acc, [featureId, privileges]) => { | ||
| return { | ||
| ...acc, | ||
| [featureId]: Object.keys(privileges), | ||
| }; | ||
| }, {}); | ||
| } | ||
|
|
||
| public getPrivileges(featureId: string): string[] { | ||
| return Object.keys(this.featurePrivilegesMap[featureId]); | ||
| } | ||
|
|
||
| public getActions(featureId: string, privilege: string): string[] { | ||
| if (!this.featurePrivilegesMap[featureId]) { | ||
| return []; | ||
| } | ||
| return this.featurePrivilegesMap[featureId][privilege] || []; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| export class GlobalPrivileges { | ||
| constructor(private readonly globalPrivilegesMap: Record<string, string[]>) {} | ||
|
|
||
| public getAllPrivileges(): string[] { | ||
| return Object.keys(this.globalPrivilegesMap); | ||
| } | ||
|
|
||
| public getActions(privilege: string): string[] { | ||
| return this.globalPrivilegesMap[privilege] || []; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import { PrivilegeMap } from '../kibana_privilege'; | ||
| import { FeaturePrivileges } from './feature_privileges'; | ||
| import { GlobalPrivileges } from './global_privileges'; | ||
| import { SpacesPrivileges } from './spaces_privileges'; | ||
|
|
||
| export class PrivilegeDefinition { | ||
| constructor(private readonly privilegeActionMap: PrivilegeMap) {} | ||
|
|
||
| public getGlobalPrivileges() { | ||
| return new GlobalPrivileges(this.privilegeActionMap.global); | ||
| } | ||
|
|
||
| public getSpacesPrivileges() { | ||
| return new SpacesPrivileges(this.privilegeActionMap.space); | ||
| } | ||
|
|
||
| public getFeaturePrivileges() { | ||
| return new FeaturePrivileges(this.privilegeActionMap.features); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| export class SpacesPrivileges { | ||
| constructor(private readonly spacesPrivilegesMap: Record<string, string[]>) {} | ||
|
|
||
| public getAllPrivileges(): string[] { | ||
| return Object.keys(this.spacesPrivilegesMap); | ||
| } | ||
|
|
||
| public getActions(privilege: string): string[] { | ||
| return this.spacesPrivilegesMap[privilege] || []; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| */ | ||
|
|
||
| import { IndexPrivilege } from './index_privilege'; | ||
| import { KibanaPrivilege } from './kibana_privilege'; | ||
| import { KibanaPrivilegeSpec } from './kibana_privilege'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: renaming |
||
|
|
||
| export interface Role { | ||
| name: string; | ||
|
|
@@ -14,16 +14,13 @@ export interface Role { | |
| indices: IndexPrivilege[]; | ||
| run_as: string[]; | ||
| }; | ||
| kibana: { | ||
| global: KibanaPrivilege[]; | ||
| space: { | ||
| [spaceId: string]: KibanaPrivilege[]; | ||
| }; | ||
| }; | ||
| kibana: KibanaPrivilegeSpec[]; | ||
| metadata?: { | ||
| [anyKey: string]: any; | ||
| }; | ||
| transient_metadata?: { | ||
| [anyKey: string]: any; | ||
| }; | ||
| _transform_error?: string[]; | ||
| _unrecognized_applications?: string[]; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @import './management/users/index'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @import './users'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // HACK -- Fix for background color full-height of browser | ||
| .secUsersEditPage, | ||
| .secUsersListingPage { | ||
| min-height: calc(100vh - 70px); | ||
| } | ||
|
|
||
| .secUsersListingPage__content { | ||
| flex-grow: 0; | ||
| } | ||
|
|
||
| .secUsersEditPage__content { | ||
| max-width: $secFormWidth; | ||
| margin-left: auto; | ||
| margin-right: auto; | ||
| flex-grow: 0; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's interactively play around with the naming of some of these common models, they're getting a bit inconsistent.