-
Notifications
You must be signed in to change notification settings - Fork 14k
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
Allow users to view dashboards they own #4520
Allow users to view dashboards they own #4520
Conversation
LGTM |
It seems like users have a similar issue beyond a Dashboard context. I did not realize it was possible to create a datasource/table without having access to the underlying database/schema of that datasource/table. Even with this change, they may still have that issue, as this change only solves the case of not being able to see an empty / inaccessible dashboard in the dashboard list. I do not think this fixes the issues mentioned above, unless other parts of the code have changed since then. |
Ah, I see. I misread Dashboard as Datasource. |
Any updates on this? |
I don't have merge privileges but this LGTM. |
@jeffreythewang isn't the current logic that a user is able to see the dashboard if the have access to at least one of the underlying slices (as opposed to all), per this logic:
My understanding is this query returns the distinct dashboard IDs which are represented by any (per the `IN condition) of the sanctioned slices. I wonder whether this is being confused with #4737. |
@john-bodley Yes that is the current logic. This change mainly addresses the case where a Dashboard is empty, as the user will not be able to see it since they do not have access to any slices in the Dashboard (because there are no slices in the Dashboard). With this change, if the Dashboard contains zero slices, but you are the owner of that Dashboard, you will still be able to view it in the Dashboard list. This happens when a user wants to start by creating an empty dashboard, and then adding slices to it. It's not a common use case, but it happens sometimes. |
@jeffreythewang I agree with your logic regarding empty dashboards which this PR resolves, but I think your original comment
is not correct according to the current logic. Maybe it would be good to updated the PR title and description to better reflect the change. Also I wonder whether a unit test would be valuable here. |
@john-bodley I think what I meant by that was, if there is a dashboard where all of the charts on that dashboard are inaccessible to the user, but the user is the owner of the dashboard, then in the current implementation, the user will not see that dashboard in the dashboard list view. Also, I'll add a unit test. |
Thanks @jeffreythewang |
Note this filter is also used when you try to add a slice to an existing dashboard and thus if you create an empty dashboard you'll now be able to add a slice to it. |
1dcc7de
to
567d0e6
Compare
567d0e6
to
513ceb0
Compare
Codecov Report
@@ Coverage Diff @@
## master #4520 +/- ##
=========================================
+ Coverage 77.5% 77.5% +<.01%
=========================================
Files 44 44
Lines 8720 8722 +2
=========================================
+ Hits 6758 6760 +2
Misses 1962 1962
Continue to review full report at Codecov.
|
@john-bodley just an update - I've added a unit test |
* Allow owners to view their own dashboards * Update docstring * update sm variable * Add unit test * misc linter (cherry picked from commit 2a3d297)
* Allow owners to view their own dashboards * Update docstring * update sm variable * Add unit test * misc linter
* Allow owners to view their own dashboards * Update docstring * update sm variable * Add unit test * misc linter
This change allows users to see the dashboards they own listed in the dashboard list. Previously, users could only see dashboards in the list if the dashboard contained at least 1 chart that they have access to. This means that a user cannot find their dashboard in the list if they create an empty dashboard (either by mistake, or as a blank template to start adding charts).
For the case where they are the owner of a dashboard, but all of the charts in their dashboard are not accessible (which can only happen if an additional owner adds an inaccessible chart to the dashboard), they will see a dashboard with a bunch of charts with permission errors. I think this is okay, as it is the same behavior as when a user has access to some but not all charts in a dashboard. Feel free to comment otherwise, and I can add an additional check for this to be applied to empty dashboards only.