feat(auth): when user is not logged in, failure to access a dashboard should redirect to login screen#30380
Conversation
not sure if changes to manager.py are necessary or an artifact of experimenting
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #30380 +/- ##
===========================================
+ Coverage 60.48% 83.90% +23.41%
===========================================
Files 1931 533 -1398
Lines 76236 38524 -37712
Branches 8568 0 -8568
===========================================
- Hits 46114 32322 -13792
+ Misses 28017 6202 -21815
+ Partials 2105 0 -2105
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
villebro
left a comment
There was a problem hiding this comment.
LGTM with a non-blocking question on the next url param.
… should redirect to login screen (apache#30380)
|
@sfirke i have a public dashboard and its redirecting users to Does this PR handle this case too ? I am using oauth with superset 4.1.1 (this works in the basic auth setting) |
|
@Ishankoradia two things:
|
|
Thanks @sfirke for the really quick response. I will check my configuration again but correct me if I am wrong. Two important things to allow dashboards to he viewed publicly (without authentication)
Am I missing something ? |
|
I will look at my config tomorrow but try enabling the DASHBOARD_RBAC feature flag if that works for your security model. |
|
I don't have |
|
Ahh gotcha !!! thank you so much @sfirke |
… should redirect to login screen (apache#30380)
SUMMARY
If a viewer is not logged in, or they are the public/anonymous user, and they click a link that takes them to a Superset dashboard that is not public, they are currently told "You don't have access" and sent to the list of dashboards, where they will see only public ones listed. This is often misleading: in most cases, the problem is not that they don't have access -- they just need to log in.
After the PR, such cases are routed to the login screen, and after a successful login the users are sent back to the dashboard they were trying to access.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE
current_redirect.mp4
AFTER
redirect_new.mp4
note I've changed the error message since recording this
TESTING INSTRUCTIONS
Create a dashboard with restricted access, try to view it while not logged in.
ADDITIONAL INFORMATION
Implements this feature request: #22190
Replaces this stale PR: #23280
I have the DASHBOARD_RBAC flag enabled as well as the Public role in use. My code alterations are minimal so I don't think it will negatively affect deployments that differ from mine, but it would be good to have someone check.
I'm not sure how to write tests for this but am open to it if someone can advise.