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

[Reporting] Allow custom roles to use image reporting in dashboard #163873

Merged
merged 7 commits into from
Aug 15, 2023

Conversation

rshen91
Copy link
Contributor

@rshen91 rshen91 commented Aug 14, 2023

Summary

This PR fixes a bug mentioned in https://github.com/elastic/sdh-kibana/issues/4016 from #153429 where users with custom roles should allow them the ability to generate reports (with xpack.reporting.roles.enabled: false) in Dashboard. This bug doesn't arise for users with all privileges.

  • set xpack.reporting.roles.enabled false in the kibana.yml
  • load sample data
  • create a custom role where the index (whatever sample data index you want) has the read and view_index_metadata privilege.
  • Add the Kibana privilege for all spaces Analytics > Dashboard > Generate PDF or PNG Reports and Download Csv reports from Saved Search panels. Create the global privilege and then the role.
  • Apply that role to a new user and log in using that user.

Before

You can see in the console that usesUiCapabilitie in register_pdf_png_reporting.tsx is true

Screenshot 2023-08-14 at 12 34 38 PM

After

Screenshot 2023-08-14 at 2 18 30 PM

Checklist

Delete any items that are not applicable to this PR.

@rshen91 rshen91 self-assigned this Aug 14, 2023
@rshen91 rshen91 added (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) Team: AWP: Visualization AWP team that does most fullstack work in kibana and removed (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead Team: AWP: Visualization AWP team that does most fullstack work in kibana labels Aug 14, 2023
@rshen91 rshen91 changed the title [Reporting] fix custom roles image reporting in dashboard [Reporting] Allow custom roles to use image reporting in dashboard Aug 14, 2023
if (
isSupportedType &&
!capabilityHasVisualizeScreenshotReporting &&
!capabilityHasDashboardScreenshotReporting
Copy link
Contributor Author

@rshen91 rshen91 Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to return an empty array for Dashboard users if they have the right permissions defined in isSupportedType

@rshen91 rshen91 added the bug Fixes for quality problems that affect the customer experience label Aug 15, 2023
@rshen91 rshen91 marked this pull request as ready for review August 15, 2023 14:23
@rshen91 rshen91 requested a review from a team as a code owner August 15, 2023 14:23
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It's fine with me if you'd like to remove the TODO on line 85 in register_pdf_png_reporting.tsx
  2. There is a functional test that should have caught this: Dashboard: Generate Screenshot > does allow PDF generation user with reporting privileges. @rshen91 Any idea why that test didn't catch this?
    • test is in x-pack/test/reporting_functional/reporting_and_security/security_roles_privileges.ts

@rshen91
Copy link
Contributor Author

rshen91 commented Aug 15, 2023

Actually disregard, the tests should have been failing for the data_analyst users ... @tsullivan I looked through x-pack/test/accessibility/apps/reporting.ts and it looks like there's the user kibana_user that seems to have all privileges? I was finding the bug when the privileges were reduced to read and view_index_metadata only.
Screenshot 2023-08-15 at 11 46 11 AM

@tsullivan
Copy link
Member

Actually disregard, the tests should have been failing for the data_analyst users

Sounds like the privileges given to the test user is causing some confusion. Let's greatly simplify this in a separate issue and ensure that functional tests and API tests use test users with the minimum amount of privilege needed for the feature.

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, provided we have a separate issue later to simplify the test user privileges and give them just the minimal privileges that the feature requires.

@rshen91 rshen91 enabled auto-merge (squash) August 15, 2023 18:51
@rshen91 rshen91 added the backport:all-open Backport to all branches that could still receive a release label Aug 15, 2023
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
reporting 43.1KB 43.1KB +4.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @rshen91

@rshen91 rshen91 merged commit 54d11a9 into elastic:main Aug 15, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 15, 2023
…lastic#163873)

## Summary

This PR fixes a bug mentioned in
https://github.com/elastic/sdh-kibana/issues/4016 from
elastic#153429 where users with custom
roles should allow them the ability to generate reports (with
`xpack.reporting.roles.enabled: false`) in Dashboard. This bug doesn't
arise for users with all privileges.

- set xpack.reporting.roles.enabled false in the kibana.yml
- load sample data
- create a custom role where the index (whatever sample data index you
want) has the read and view_index_metadata privilege.
- Add the Kibana privilege for all spaces Analytics > Dashboard >
Generate PDF or PNG Reports and Download Csv reports from Saved Search
panels. Create the global privilege and then the role.
- Apply that role to a new user and log in using that user.

## Before

You can see in the console that usesUiCapabilitie in
register_pdf_png_reporting.tsx is true

<img width="1458" alt="Screenshot 2023-08-14 at 12 34 38 PM"
src="https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb">

## After
<img width="1343" alt="Screenshot 2023-08-14 at 2 18 30 PM"
src="https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131">

### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 54d11a9)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
7.17 Backport failed because of merge conflicts
8.9

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 163873

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Aug 15, 2023
…ard (#163873) (#163972)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Reporting] Allow custom roles to use image reporting in dashboard
(#163873)](#163873)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Rachel
Shen","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-08-15T19:42:06Z","message":"[Reporting]
Allow custom roles to use image reporting in dashboard (#163873)\n\n##
Summary\r\n\r\nThis PR fixes a bug mentioned
in\r\nhttps://github.com/elastic/sdh-kibana/issues/4016
from\r\nhttps://github.com//pull/153429 where users with
custom\r\nroles should allow them the ability to generate reports
(with\r\n`xpack.reporting.roles.enabled: false`) in Dashboard. This bug
doesn't\r\narise for users with all privileges.\r\n\r\n- set
xpack.reporting.roles.enabled false in the kibana.yml \r\n- load sample
data \r\n- create a custom role where the index (whatever sample data
index you\r\nwant) has the read and view_index_metadata privilege.\r\n-
Add the Kibana privilege for all spaces Analytics > Dashboard
>\r\nGenerate PDF or PNG Reports and Download Csv reports from Saved
Search\r\npanels. Create the global privilege and then the role.\r\n-
Apply that role to a new user and log in using that user. \r\n\r\n\r\n##
Before \r\n\r\nYou can see in the console that usesUiCapabilitie
in\r\nregister_pdf_png_reporting.tsx is true\r\n\r\n<img width=\"1458\"
alt=\"Screenshot 2023-08-14 at 12 34 38
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb\">\r\n\r\n\r\n##
After\r\n<img width=\"1343\" alt=\"Screenshot 2023-08-14 at 2 18 30
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131\">\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] 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[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"54d11a964c1ed86268cb1a5aca24674895ffdf13","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Feature:Reporting","Team:SharedUX","backport:all-open","v8.10.0"],"number":163873,"url":"https://github.com/elastic/kibana/pull/163873","mergeCommit":{"message":"[Reporting]
Allow custom roles to use image reporting in dashboard (#163873)\n\n##
Summary\r\n\r\nThis PR fixes a bug mentioned
in\r\nhttps://github.com/elastic/sdh-kibana/issues/4016
from\r\nhttps://github.com//pull/153429 where users with
custom\r\nroles should allow them the ability to generate reports
(with\r\n`xpack.reporting.roles.enabled: false`) in Dashboard. This bug
doesn't\r\narise for users with all privileges.\r\n\r\n- set
xpack.reporting.roles.enabled false in the kibana.yml \r\n- load sample
data \r\n- create a custom role where the index (whatever sample data
index you\r\nwant) has the read and view_index_metadata privilege.\r\n-
Add the Kibana privilege for all spaces Analytics > Dashboard
>\r\nGenerate PDF or PNG Reports and Download Csv reports from Saved
Search\r\npanels. Create the global privilege and then the role.\r\n-
Apply that role to a new user and log in using that user. \r\n\r\n\r\n##
Before \r\n\r\nYou can see in the console that usesUiCapabilitie
in\r\nregister_pdf_png_reporting.tsx is true\r\n\r\n<img width=\"1458\"
alt=\"Screenshot 2023-08-14 at 12 34 38
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb\">\r\n\r\n\r\n##
After\r\n<img width=\"1343\" alt=\"Screenshot 2023-08-14 at 2 18 30
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131\">\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] 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[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"54d11a964c1ed86268cb1a5aca24674895ffdf13"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/163873","number":163873,"mergeCommit":{"message":"[Reporting]
Allow custom roles to use image reporting in dashboard (#163873)\n\n##
Summary\r\n\r\nThis PR fixes a bug mentioned
in\r\nhttps://github.com/elastic/sdh-kibana/issues/4016
from\r\nhttps://github.com//pull/153429 where users with
custom\r\nroles should allow them the ability to generate reports
(with\r\n`xpack.reporting.roles.enabled: false`) in Dashboard. This bug
doesn't\r\narise for users with all privileges.\r\n\r\n- set
xpack.reporting.roles.enabled false in the kibana.yml \r\n- load sample
data \r\n- create a custom role where the index (whatever sample data
index you\r\nwant) has the read and view_index_metadata privilege.\r\n-
Add the Kibana privilege for all spaces Analytics > Dashboard
>\r\nGenerate PDF or PNG Reports and Download Csv reports from Saved
Search\r\npanels. Create the global privilege and then the role.\r\n-
Apply that role to a new user and log in using that user. \r\n\r\n\r\n##
Before \r\n\r\nYou can see in the console that usesUiCapabilitie
in\r\nregister_pdf_png_reporting.tsx is true\r\n\r\n<img width=\"1458\"
alt=\"Screenshot 2023-08-14 at 12 34 38
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb\">\r\n\r\n\r\n##
After\r\n<img width=\"1343\" alt=\"Screenshot 2023-08-14 at 2 18 30
PM\"\r\nsrc=\"https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131\">\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] 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[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"54d11a964c1ed86268cb1a5aca24674895ffdf13"}}]}]
BACKPORT-->

Co-authored-by: Rachel Shen <[email protected]>
@rshen91
Copy link
Contributor Author

rshen91 commented Aug 16, 2023

💚 All backports created successfully

Status Branch Result
8.8

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

rshen91 added a commit to rshen91/kibana that referenced this pull request Aug 16, 2023
…lastic#163873)

## Summary

This PR fixes a bug mentioned in
https://github.com/elastic/sdh-kibana/issues/4016 from
elastic#153429 where users with custom
roles should allow them the ability to generate reports (with
`xpack.reporting.roles.enabled: false`) in Dashboard. This bug doesn't
arise for users with all privileges.

- set xpack.reporting.roles.enabled false in the kibana.yml
- load sample data
- create a custom role where the index (whatever sample data index you
want) has the read and view_index_metadata privilege.
- Add the Kibana privilege for all spaces Analytics > Dashboard >
Generate PDF or PNG Reports and Download Csv reports from Saved Search
panels. Create the global privilege and then the role.
- Apply that role to a new user and log in using that user.

## Before

You can see in the console that usesUiCapabilitie in
register_pdf_png_reporting.tsx is true

<img width="1458" alt="Screenshot 2023-08-14 at 12 34 38 PM"
src="https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb">

## After
<img width="1343" alt="Screenshot 2023-08-14 at 2 18 30 PM"
src="https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131">

### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 54d11a9)
hop-dev pushed a commit to hop-dev/kibana that referenced this pull request Aug 16, 2023
…lastic#163873)

## Summary

This PR fixes a bug mentioned in
elastic/sdh-kibana#4016 from
elastic#153429 where users with custom
roles should allow them the ability to generate reports (with
`xpack.reporting.roles.enabled: false`) in Dashboard. This bug doesn't
arise for users with all privileges.

- set xpack.reporting.roles.enabled false in the kibana.yml 
- load sample data 
- create a custom role where the index (whatever sample data index you
want) has the read and view_index_metadata privilege.
- Add the Kibana privilege for all spaces Analytics > Dashboard >
Generate PDF or PNG Reports and Download Csv reports from Saved Search
panels. Create the global privilege and then the role.
- Apply that role to a new user and log in using that user. 


## Before 

You can see in the console that usesUiCapabilitie in
register_pdf_png_reporting.tsx is true

<img width="1458" alt="Screenshot 2023-08-14 at 12 34 38 PM"
src="https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb">


## After
<img width="1343" alt="Screenshot 2023-08-14 at 2 18 30 PM"
src="https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131">


### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
@mistic mistic added v8.9.2 and removed v8.9.1 labels Aug 17, 2023
@mistic
Copy link
Member

mistic commented Aug 17, 2023

This pr didn't make it into the build candidate for v8.9.1. Updating the labels.

bryce-b pushed a commit that referenced this pull request Aug 22, 2023
…163873)

## Summary

This PR fixes a bug mentioned in
elastic/sdh-kibana#4016 from
#153429 where users with custom
roles should allow them the ability to generate reports (with
`xpack.reporting.roles.enabled: false`) in Dashboard. This bug doesn't
arise for users with all privileges.

- set xpack.reporting.roles.enabled false in the kibana.yml 
- load sample data 
- create a custom role where the index (whatever sample data index you
want) has the read and view_index_metadata privilege.
- Add the Kibana privilege for all spaces Analytics > Dashboard >
Generate PDF or PNG Reports and Download Csv reports from Saved Search
panels. Create the global privilege and then the role.
- Apply that role to a new user and log in using that user. 


## Before 

You can see in the console that usesUiCapabilitie in
register_pdf_png_reporting.tsx is true

<img width="1458" alt="Screenshot 2023-08-14 at 12 34 38 PM"
src="https://github.com/elastic/kibana/assets/20343860/f6b567fa-3fbd-4039-aa64-fd28bb4534fb">


## After
<img width="1343" alt="Screenshot 2023-08-14 at 2 18 30 PM"
src="https://github.com/elastic/kibana/assets/20343860/1e4ade9e-332c-4431-954a-38e8a16d4131">


### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:all-open Backport to all branches that could still receive a release bug Fixes for quality problems that affect the customer experience (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:fix Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.9.2 v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants