-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] - Reactify roles screen #19035
Merged
legrego
merged 43 commits into
elastic:spaces-phase-1
from
legrego:reactify-roles-screen
Jun 7, 2018
Merged
Changes from 33 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
67e05db
round 1
legrego 904a6b7
validation and cleanup
legrego 8ae7325
Fix react warnings
legrego 2c70cc1
Hook UI actions to API
legrego 036c4e4
adds some testing
legrego 378e78c
replace spaces with dashes when typing role name
legrego d888a93
use new isDisabled prop for EuiComoBoxes
legrego 63028de
Update version of EUI to get disable-able ComboBox components
legrego 5f0688b
Merge branch 'rbac-phase-1' into reactify-roles-screen
legrego 3984c2b
working port from rbac-phase-1
legrego 4f39d2b
refactor permission components
legrego 918cca4
combine role utils into a single file
legrego fcc7432
add index.js to components directory
legrego 74e1d4a
Improve form validation
legrego 92812e5
Fixes #18166 : warn when no fields are granted
legrego f50db3f
Merge branch 'spaces-phase-1' into reactify-roles-screen
legrego b6d1b9a
Disable certain edits for Reserved Spaces
legrego 36e7a67
Adding built-in types and alphabetizing (#19306)
kobelb 06eb784
Filtering out non-default resource Kibana privileges (#19321)
kobelb 74891fd
Initial design refactor of edit roles screen
legrego ad0ec04
improved ui for reserved roles
legrego ebf85d8
create CollapsiblePanel component for roles screen
legrego a826ee5
Improve readonly view
legrego d188dc8
Fix save logic
legrego 4464482
Re-add granted fields warning
legrego 767fb27
Removing unused file
kobelb 0baea66
Merge branch 'rbac-phase-1' into reactify-roles-screen
legrego ebd09d1
additional tests
legrego 642eaae
port remainder of index privs logic, and remove angular version of th…
legrego 009c29f
additional tests and a bugfix
legrego d0c44e9
remove unused code
legrego c5366f6
address PR feedback
legrego abb55d7
improve role validation
legrego cb02fe1
Design edits
cchaos 87f8cd8
start addressing design feedback
legrego bb1c129
Don't hide delete button for placeholder privileges
legrego 829a6e7
change Kibana Privileges to use a select instead of checkboxes
legrego c777670
upgrade to EUI 0.0.51, and fix Role breadcrumbs
legrego b05d937
fix doc links
legrego d901b52
Merge branch 'reactify-roles-screen' into legrego-reactify-roles-screen
legrego 4283e29
Merge pull request #2 from cchaos/legrego-reactify-roles-screen
legrego 6adfe2a
Fix tests and cleanup unused code
legrego e739e5c
design updates
legrego File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* 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 { isRoleEnabled, isReservedRole } from './role'; | ||
|
||
describe('role', () => { | ||
describe('isRoleEnabled', () => { | ||
test('should return false if role is explicitly not enabled', () => { | ||
const testRole = { | ||
transient_metadata: { | ||
enabled: false | ||
} | ||
}; | ||
expect(isRoleEnabled(testRole)).toBe(false); | ||
}); | ||
|
||
test('should return true if role is explicitly enabled', () => { | ||
const testRole = { | ||
transient_metadata: { | ||
enabled: true | ||
} | ||
}; | ||
expect(isRoleEnabled(testRole)).toBe(true); | ||
}); | ||
|
||
test('should return true if role is NOT explicitly enabled or disabled', () => { | ||
const testRole = {}; | ||
expect(isRoleEnabled(testRole)).toBe(true); | ||
}); | ||
}); | ||
|
||
describe('isReservedRole', () => { | ||
test('should return false if role is explicitly not reserved', () => { | ||
const testRole = { | ||
metadata: { | ||
_reserved: false | ||
} | ||
}; | ||
expect(isReservedRole(testRole)).toBe(false); | ||
}); | ||
|
||
test('should return true if role is explicitly reserved', () => { | ||
const testRole = { | ||
metadata: { | ||
_reserved: true | ||
} | ||
}; | ||
expect(isReservedRole(testRole)).toBe(true); | ||
}); | ||
|
||
test('should return false if role is NOT explicitly reserved or not reserved', () => { | ||
const testRole = {}; | ||
expect(isReservedRole(testRole)).toBe(false); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* 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 { saveRole, deleteRole } from './lib/roles'; | ||
|
||
export { getFields } from './lib/get_fields'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* 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 chrome from 'ui/chrome'; | ||
|
||
const apiBase = chrome.addBasePath(`/api/security/v1/fields`); | ||
|
||
export async function getFields($http, query) { | ||
return await $http | ||
.get(`${apiBase}/${query}`) | ||
.then(response => response.data || []); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* 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 chrome from 'ui/chrome'; | ||
|
||
const apiBase = chrome.addBasePath(`/api/security/v1/roles`); | ||
|
||
export async function saveRole($http, role) { | ||
return await $http.post(`${apiBase}/${role.name}`, role); | ||
} | ||
|
||
export async function deleteRole($http, name) { | ||
return await $http.delete(`${apiBase}/${name}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 class Role { | ||
name = null; | ||
cluster = []; | ||
indices = []; | ||
run_as = []; //eslint-disable-line camelcase | ||
applications = []; | ||
} |
42 changes: 42 additions & 0 deletions
42
x-pack/plugins/security/public/services/role_privileges.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
const clusterPrivileges = [ | ||
'all', | ||
'monitor', | ||
'manage', | ||
'manage_security', | ||
'manage_index_templates', | ||
'manage_pipeline', | ||
'manage_ingest_pipelines', | ||
'transport_client', | ||
'manage_ml', | ||
'monitor_ml', | ||
'manage_watcher', | ||
'monitor_watcher', | ||
]; | ||
const indexPrivileges = [ | ||
'all', | ||
'manage', | ||
'monitor', | ||
'read', | ||
'index', | ||
'create', | ||
'delete', | ||
'write', | ||
'delete_index', | ||
'create_index', | ||
'view_index_metadata', | ||
'read_cross_cluster', | ||
]; | ||
|
||
export function getClusterPrivileges() { | ||
return [...clusterPrivileges]; | ||
} | ||
|
||
export function getIndexPrivileges() { | ||
return [...indexPrivileges]; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Any reason we aren't using
${DOC_LINK_VERSION}
in place ofcurrent
? Generally we try to make the doc links in Kibana point to the specific version, so that 6.3 of Kibana always links to 6.3 of the docs, this helps to prevent dead-links from occurring or linking to docs that are incorrect.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.
gah how did I let that happen? Good catch, will fix!