-
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
[RAM] Enable read-only users to access rules #167003
[RAM] Enable read-only users to access rules #167003
Conversation
…rs-cannot-see-rules
Pinging @elastic/response-ops (Team:ResponseOps) |
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.
Observability_functional test change LGTM!
); | ||
await retry.waitFor( | ||
'Create rule button is disabled', | ||
async () => !(await testSubjects.isEnabled('createRuleButton')) |
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.
Question: How exactly does the assertion work here?
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.
I inverted the return value of the isEnabled
utility to check that the button is disabled. Don't know if there are better utilities for such a case, but it seemed pretty straightforward 🙂
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Closes elastic#166613 ## Summary Enables users with read privilege on `Stack rules` to see the rules table and the rule detail page without editing capabilities. Before: ![image](https://github.com/elastic/kibana/assets/18363145/a377819f-b140-41a4-aad9-9f5a5d779d63) After: ![image](https://github.com/elastic/kibana/assets/18363145/0c1bbf08-0f7b-4778-ae3e-062b0bd49c8f) In case of empty rules lists, the prompt "Create your first rule" was shown, even to users without create permissions: ![image](https://github.com/elastic/kibana/assets/18363145/3beaadb5-7b54-473e-9daa-e96c79e5a9f4) To avoid confusion, read-only users now see the empty table instead: ![image](https://github.com/elastic/kibana/assets/18363145/f35d212a-bc3e-4ee6-a3af-605966efced9) In the rule detail page, users without access to `Actions and Connectors` now see a missing privileges message under `Actions` in the details panel instead of `No actions` and a `Forbidden` error toast. ![image](https://github.com/elastic/kibana/assets/18363145/7d3edeae-3cd0-44c5-be2b-57ba4b54f69e) Finally, the original missing authorization prompt now shows "read" instead of "create": ![image](https://github.com/elastic/kibana/assets/18363145/f88b492d-3b20-41ac-a7c7-3cdd7f971ee5) ## To test - Create an Elasticsearch query rule - Create a Role with read privilege granted in `Stack rules` (under Kibana > Management) and assign it to a user - Create a test user with the created role - Log in as the test user - Navigate to Stack Management > Rules - Check that the rules table is visible, with create and update actions disabled ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) --------- Co-authored-by: Xavier Mouligneau <[email protected]> (cherry picked from commit e49628a)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.11`: - [[RAM] Enable read-only users to access rules (#167003)](#167003) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Umberto Pepato","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-06T16:01:18Z","message":"[RAM] Enable read-only users to access rules (#167003)\n\nCloses #166613\r\n\r\n## Summary\r\n\r\nEnables users with read privilege on `Stack rules` to see the rules\r\ntable and the rule detail page without editing capabilities. Before:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/a377819f-b140-41a4-aad9-9f5a5d779d63)\r\n\r\nAfter:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/0c1bbf08-0f7b-4778-ae3e-062b0bd49c8f)\r\n\r\nIn case of empty rules lists, the prompt \"Create your first rule\" was\r\nshown, even to users without create permissions:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/3beaadb5-7b54-473e-9daa-e96c79e5a9f4)\r\n\r\nTo avoid confusion, read-only users now see the empty table instead:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/f35d212a-bc3e-4ee6-a3af-605966efced9)\r\n\r\nIn the rule detail page, users without access to `Actions and\r\nConnectors` now see a missing privileges message under `Actions` in the\r\ndetails panel instead of `No actions` and a `Forbidden` error toast.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/7d3edeae-3cd0-44c5-be2b-57ba4b54f69e)\r\n\r\nFinally, the original missing authorization prompt now shows \"read\"\r\ninstead of \"create\":\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/f88b492d-3b20-41ac-a7c7-3cdd7f971ee5)\r\n\r\n## To test\r\n\r\n- Create an Elasticsearch query rule\r\n- Create a Role with read privilege granted in `Stack rules` (under\r\nKibana > Management) and assign it to a user\r\n- Create a test user with the created role\r\n- Log in as the test user\r\n- Navigate to Stack Management > Rules\r\n- Check that the rules table is visible, with create and update actions\r\ndisabled\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n\r\n---------\r\n\r\nCo-authored-by: Xavier Mouligneau <[email protected]>","sha":"e49628acabcb8c566f9d30a72b88129151f829ee","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:ResponseOps","v8.11.0","v8.12.0"],"number":167003,"url":"https://github.com/elastic/kibana/pull/167003","mergeCommit":{"message":"[RAM] Enable read-only users to access rules (#167003)\n\nCloses #166613\r\n\r\n## Summary\r\n\r\nEnables users with read privilege on `Stack rules` to see the rules\r\ntable and the rule detail page without editing capabilities. Before:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/a377819f-b140-41a4-aad9-9f5a5d779d63)\r\n\r\nAfter:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/0c1bbf08-0f7b-4778-ae3e-062b0bd49c8f)\r\n\r\nIn case of empty rules lists, the prompt \"Create your first rule\" was\r\nshown, even to users without create permissions:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/3beaadb5-7b54-473e-9daa-e96c79e5a9f4)\r\n\r\nTo avoid confusion, read-only users now see the empty table instead:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/f35d212a-bc3e-4ee6-a3af-605966efced9)\r\n\r\nIn the rule detail page, users without access to `Actions and\r\nConnectors` now see a missing privileges message under `Actions` in the\r\ndetails panel instead of `No actions` and a `Forbidden` error toast.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/7d3edeae-3cd0-44c5-be2b-57ba4b54f69e)\r\n\r\nFinally, the original missing authorization prompt now shows \"read\"\r\ninstead of \"create\":\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/f88b492d-3b20-41ac-a7c7-3cdd7f971ee5)\r\n\r\n## To test\r\n\r\n- Create an Elasticsearch query rule\r\n- Create a Role with read privilege granted in `Stack rules` (under\r\nKibana > Management) and assign it to a user\r\n- Create a test user with the created role\r\n- Log in as the test user\r\n- Navigate to Stack Management > Rules\r\n- Check that the rules table is visible, with create and update actions\r\ndisabled\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n\r\n---------\r\n\r\nCo-authored-by: Xavier Mouligneau <[email protected]>","sha":"e49628acabcb8c566f9d30a72b88129151f829ee"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/167003","number":167003,"mergeCommit":{"message":"[RAM] Enable read-only users to access rules (#167003)\n\nCloses #166613\r\n\r\n## Summary\r\n\r\nEnables users with read privilege on `Stack rules` to see the rules\r\ntable and the rule detail page without editing capabilities. Before:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/a377819f-b140-41a4-aad9-9f5a5d779d63)\r\n\r\nAfter:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/0c1bbf08-0f7b-4778-ae3e-062b0bd49c8f)\r\n\r\nIn case of empty rules lists, the prompt \"Create your first rule\" was\r\nshown, even to users without create permissions:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/3beaadb5-7b54-473e-9daa-e96c79e5a9f4)\r\n\r\nTo avoid confusion, read-only users now see the empty table instead:\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/f35d212a-bc3e-4ee6-a3af-605966efced9)\r\n\r\nIn the rule detail page, users without access to `Actions and\r\nConnectors` now see a missing privileges message under `Actions` in the\r\ndetails panel instead of `No actions` and a `Forbidden` error toast.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/7d3edeae-3cd0-44c5-be2b-57ba4b54f69e)\r\n\r\nFinally, the original missing authorization prompt now shows \"read\"\r\ninstead of \"create\":\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18363145/f88b492d-3b20-41ac-a7c7-3cdd7f971ee5)\r\n\r\n## To test\r\n\r\n- Create an Elasticsearch query rule\r\n- Create a Role with read privilege granted in `Stack rules` (under\r\nKibana > Management) and assign it to a user\r\n- Create a test user with the created role\r\n- Log in as the test user\r\n- Navigate to Stack Management > Rules\r\n- Check that the rules table is visible, with create and update actions\r\ndisabled\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n\r\n---------\r\n\r\nCo-authored-by: Xavier Mouligneau <[email protected]>","sha":"e49628acabcb8c566f9d30a72b88129151f829ee"}}]}] BACKPORT--> Co-authored-by: Umberto Pepato <[email protected]>
Closes elastic#166613 ## Summary Enables users with read privilege on `Stack rules` to see the rules table and the rule detail page without editing capabilities. Before: ![image](https://github.com/elastic/kibana/assets/18363145/a377819f-b140-41a4-aad9-9f5a5d779d63) After: ![image](https://github.com/elastic/kibana/assets/18363145/0c1bbf08-0f7b-4778-ae3e-062b0bd49c8f) In case of empty rules lists, the prompt "Create your first rule" was shown, even to users without create permissions: ![image](https://github.com/elastic/kibana/assets/18363145/3beaadb5-7b54-473e-9daa-e96c79e5a9f4) To avoid confusion, read-only users now see the empty table instead: ![image](https://github.com/elastic/kibana/assets/18363145/f35d212a-bc3e-4ee6-a3af-605966efced9) In the rule detail page, users without access to `Actions and Connectors` now see a missing privileges message under `Actions` in the details panel instead of `No actions` and a `Forbidden` error toast. ![image](https://github.com/elastic/kibana/assets/18363145/7d3edeae-3cd0-44c5-be2b-57ba4b54f69e) Finally, the original missing authorization prompt now shows "read" instead of "create": ![image](https://github.com/elastic/kibana/assets/18363145/f88b492d-3b20-41ac-a7c7-3cdd7f971ee5) ## To test - Create an Elasticsearch query rule - Create a Role with read privilege granted in `Stack rules` (under Kibana > Management) and assign it to a user - Create a test user with the created role - Log in as the test user - Navigate to Stack Management > Rules - Check that the rules table is visible, with create and update actions disabled ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) --------- Co-authored-by: Xavier Mouligneau <[email protected]>
Closes #166613
Summary
Enables users with read privilege on
Stack rules
to see the rules table and the rule detail page without editing capabilities. Before:After:
In case of empty rules lists, the prompt "Create your first rule" was shown, even to users without create permissions:
To avoid confusion, read-only users now see the empty table instead:
In the rule detail page, users without access to
Actions and Connectors
now see a missing privileges message underActions
in the details panel instead ofNo actions
and aForbidden
error toast.Finally, the original missing authorization prompt now shows "read" instead of "create":
To test
Stack rules
(under Kibana > Management) and assign it to a userChecklist