-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
feat(revert): Re-introduces the RLS page #23777
feat(revert): Re-introduces the RLS page #23777
Conversation
Codecov Report
@@ Coverage Diff @@
## master #23777 +/- ##
==========================================
+ Coverage 67.87% 67.98% +0.10%
==========================================
Files 1925 1936 +11
Lines 74389 74913 +524
Branches 8108 8139 +31
==========================================
+ Hits 50494 50928 +434
- Misses 21818 21893 +75
- Partials 2077 2092 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks for the un-revert @michael-s-molina , and thanks @mayurnewase for the awesome work on this! |
awesome!!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really nice work, thanks again @mayurnewase and @michael-s-molina for reviving it. As we're doing breaking changes, I really think we should takes this opportunity to widen the scope of EXTRA_RELATED_QUERY_FIELDS
and deprecate the RLS specific RLS_BASE_RELATED_FIELD_FILTERS
. That latter was created before the formerly mentioned one was created (=there was no global related filter that could be leveraged), and using the same param for all views will ensure that we'll be able to introduce more superuser-like functionality to superset without needing to assign admin role to users.
edit_model_schema = RLSPutSchema() | ||
|
||
allowed_rel_fields = {"tables", "roles"} | ||
base_related_field_filters = app.config["RLS_BASE_RELATED_FIELD_FILTERS"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #22526 we introduced EXTRA_RELATED_QUERY_FILTERS
which already has filters for role
and user
. I think it might make sense deprecate RLS_BASE_RELATED_FIELD_FILTERS
and leverage the more global config parameter here by doing the following:
- assume that
EXTRA_RELATED_QUERY_FILTERS["role"]
also applies to RLS - Reuse the existing
DatasourceFilter
for tables
I tried this and it nicely filtered the roles and tables to match what's available on the datasets page and elsewhere (I don't see why we'd want to have a different dataset filter for RLS than what the regular RBAC model provides, unless we want to add additional filters in RLS):
from superset.views.base import DatasourceFilter
from superset.views.filters import BaseFilterRelatedRoles
base_related_field_filters = {
"tables": [["id", DatasourceFilter, lambda: []]],
"roles": [["id", BaseFilterRelatedRoles, lambda: []]],
}
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense to me. Can you open a follow-up with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michael-s-molina sure, will do 👍
SUMMARY
This PR re-introduces the changes made in #22325 that were reverted because it introduced breaking changes to master.
This PR is not an exact revert of the revert because it adapts the files to the pages structure. It also worth mentioning that the menu option to the RLS page is currently triggering a reload and we should work on a follow-up to make it fully compatible with the SPA project.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Check the original PR for screenshots.
TESTING INSTRUCTIONS
Check the original PR for test instructions.
ADDITIONAL INFORMATION