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

Browse: Hide dashboard actions if user does not have enough permission #55218

Merged
merged 2 commits into from Sep 16, 2022

Conversation

lpskdl
Copy link
Contributor

@lpskdl lpskdl commented Sep 15, 2022

What this PR does / why we need it:
This PR will hide the dashboard actions when user doesn't have enough permission.

Screen.Recording.2022-09-15.at.10.48.36.mov

Which issue(s) this PR fixes:

Fixes #55216

Special notes for your reviewer:

@lpskdl lpskdl added this to the 9.1.6 milestone Sep 15, 2022
@lpskdl lpskdl requested review from axelavargas and a team September 15, 2022 08:49
@lpskdl lpskdl self-assigned this Sep 15, 2022
@lpskdl lpskdl requested review from joshhunt, ashharrison90 and dprokop and removed request for a team September 15, 2022 08:49
Copy link
Contributor

@JoaoSilvaGrafana JoaoSilvaGrafana left a comment

Choose a reason for hiding this comment

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

Great work Leo 🎉 Also love that you added tests, just got one question about the test


const { rerender, store } = await setup();

expect(screen.queryByRole('button', { name: /new/i })).not.toBeInTheDocument();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpicky but I didn't notice that this one test was both testing for having permissions and not having permissions, should we separate this into 2 tests so its easier to understand what each of them does? Or alternatively change the title to reflect that it is testing both scenarios

Copy link
Member

@axelavargas axelavargas left a comment

Choose a reason for hiding this comment

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

this looks great @lpskdl 👏🏾 , thanks for fixing this, and awesome job with the unit test!!

@grafanabot
Copy link
Contributor

@lpskdl lpskdl merged commit 896d684 into main Sep 16, 2022
@lpskdl lpskdl deleted the lpskdl/55216 branch September 16, 2022 07:19
@grafanabot
Copy link
Contributor

The backport to v9.1.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-55218-to-v9.1.x origin/v9.1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 896d684065bad1fb21fc39afb9f101bf76dd1a37
# Push it to GitHub
git push --set-upstream origin backport-55218-to-v9.1.x
git switch main
# Remove the local backport branch
git branch -D backport-55218-to-v9.1.x

Then, create a pull request where the base branch is v9.1.x and the compare/head branch is backport-55218-to-v9.1.x.

lpskdl added a commit that referenced this pull request Sep 16, 2022
#55218)

* hide dashboard actions if user does not have enough permission

* improve test description

(cherry picked from commit 896d684)
lpskdl added a commit that referenced this pull request Sep 16, 2022
…permission (#55279)

* Browse: Hide dashboard actions if user does not have enough permission (#55218)

* hide dashboard actions if user does not have enough permission

* improve test description

(cherry picked from commit 896d684)

* fix broken test on backport pr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard Actions should be hidden if user doesn't have permissions
4 participants