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

fix(dashboard): incorrect perm for users with multiple roles #14148

Merged
merged 2 commits into from
Apr 14, 2021

Conversation

ktmud
Copy link
Member

@ktmud ktmud commented Apr 14, 2021

SUMMARY

This fixes a bug where dashboard permission check is incorrect when users have multiple roles.

The resulted some users not seeing "View chart in Explore" link in dashboards.

cc @suddjian @pkdotson

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

perm-before

Some links in chart menu are missing if the user has multiple roles and the last role does not contain permission for [Superset, can_explore].

After

perm-after

TEST PLAN

To reproduce the bug, add a new role (e.g. sql_lab) to the logged in user.

Added unit tests.

ADDITIONAL INFORMATION

@@ -122,7 +122,7 @@
"regenerator-runtime": "^0.13.5",
"rison": "^0.1.1",
"shortid": "^2.2.6",
"urijs": "^1.19.4",
Copy link
Member Author

Choose a reason for hiding this comment

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

lockfile updated from npm ci.

Copy link
Member

@suddjian suddjian left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for fixing. I didn't even realize multiple roles were possible!

Copy link
Member

@pkdotson pkdotson left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for tests! I did not know multiple roles were possible as well!

@codecov
Copy link

codecov bot commented Apr 14, 2021

Codecov Report

Merging #14148 (c270fdc) into master (21f973f) will increase coverage by 0.21%.
The diff coverage is 100.00%.

❗ Current head c270fdc differs from pull request most recent head 9871a83. Consider uploading reports for the commit 9871a83 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14148      +/-   ##
==========================================
+ Coverage   79.70%   79.92%   +0.21%     
==========================================
  Files         945      943       -2     
  Lines       47975    47757     -218     
  Branches     6082     6015      -67     
==========================================
- Hits        38240    38169      -71     
+ Misses       9614     9469     -145     
+ Partials      121      119       -2     
Flag Coverage Δ
cypress 56.36% <100.00%> (-0.04%) ⬇️
javascript 70.19% <80.00%> (+0.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset-frontend/src/dashboard/actions/hydrate.js 85.84% <100.00%> (ø)
...rset-frontend/src/dashboard/util/findPermission.ts 100.00% <100.00%> (ø)
superset-frontend/src/filters/utils.ts 95.23% <0.00%> (-4.77%) ⬇️
...dashboard/components/SliceHeaderControls/index.jsx 78.35% <0.00%> (-1.04%) ⬇️
...src/dashboard/components/HeaderActionsDropdown.jsx
...erset-frontend/src/dashboard/components/Header.jsx
.../components/Header/HeaderActionsDropdown/index.jsx 72.36% <0.00%> (+2.63%) ⬆️
...et-frontend/src/components/EditableTitle/index.tsx 86.41% <0.00%> (+11.11%) ⬆️
...frontend/src/dashboard/components/Header/index.jsx 81.02% <0.00%> (+13.86%) ⬆️
...-frontend/src/visualizations/presets/MainPreset.js 100.00% <0.00%> (+33.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21f973f...9871a83. Read the comment docs.

@ktmud ktmud merged commit 6755083 into apache:master Apr 14, 2021
@ktmud ktmud deleted the dashboard-perm-fix branch April 14, 2021 23:07
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants