fix: Add user filtering to changed_by. Fixes #27986
SUMMARY
Adds filtering of "modified by" in the same way as for "owner".
Fixes #27986
Example superset_config.py with EXTRA_RELATED_QUERY_FILTERS configured:
# Hide all users
def user_filter(query):
from sqlalchemy.sql import false
return query.filter(false())
EXTRA_RELATED_QUERY_FILTERS = {
"user": user_filter,
}
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
- [x] Has associated issue: #27986
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in SIP-59)
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
Adding a link to the PR that introduced this feature for "owner" and "group". https://github.com/apache/superset/pull/22526
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 83.74%. Comparing base (
76d897e) to head (bc29572). Report is 1701 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #29287 +/- ##
===========================================
+ Coverage 60.48% 83.74% +23.25%
===========================================
Files 1931 524 -1407
Lines 76236 37789 -38447
Branches 8568 0 -8568
===========================================
- Hits 46114 31646 -14468
+ Misses 28017 6143 -21874
+ Partials 2105 0 -2105
| Flag | Coverage Δ | |
|---|---|---|
| hive | 49.13% <100.00%> (-0.02%) |
:arrow_down: |
| javascript | ? |
|
| mysql | 77.00% <100.00%> (?) |
|
| postgres | 77.08% <100.00%> (?) |
|
| presto | 53.71% <100.00%> (-0.10%) |
:arrow_down: |
| python | 83.74% <100.00%> (+20.23%) |
:arrow_up: |
| sqlite | 76.56% <100.00%> (?) |
|
| unit | 59.86% <100.00%> (+2.22%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@dpgaspar : I think I have corrected the formatting. Would be nice if you can start the workflows again.
CI running 🤞
@rusackas : Added missing newline to get ruff linter happy
@dpgaspar would love to get a new CI run...
Would love to get some feedback if this PR is considered for merging. Or if I can improve it in some way.
Updated branch with master to resolve merge conflict
Updated the "summary" of this PR with a better description and added "testing instructions"
Running CI again :)
Anything else I can do to get this approved/merged?
This looks awesome @marre - we would also greatly benefit from this. We'll be crossing our fingers for approval soon and we'll be willing to help if any additional work is needed
Done! Thanks for your contribution!
Thanks!
In what release will it be included in?
@supersetbot label 4.1
@marre, thank you! However, you mentioned that this would fix the 'Modified By' field issue, but the only field currently removing the list of users is 'Owner'.
Example for the 'Owner' field:
Example for the 'Modified By' field
Is there any configuration that I'm missing?
Hide all users
from sqlalchemy.sql import false
def user_filter(query):
return query.filter(false())
EXTRA_RELATED_QUERY_FILTERS = {
"user": user_filter,
"changed_by": user_filter
}
@supersetbot unlabel 4.1
@sadpandajoe Would really love to have this in 4.1...
@bruno-santos-6 What version of superset are you testing with?
Just pulled latest from superset/superset (master branch@40520c54d40f887453827ef36a9f5924119ada62)
Without EXTRA_RELATED_QUERY_FILTERS
Without EXTRA_RELATED_QUERY_FILTERS configured:
Owner:
Modified-by:
With EXTRA_RELATED_QUERY_FILTERS
Added this to my superset_config.py:
def user_filter(query):
from sqlalchemy.sql import false
return query.filter(false())
EXTRA_RELATED_QUERY_FILTERS = {
"user": user_filter,
}
Started with:
export SUPERSET_CONFIG_PATH=./superset_config.py
superset run -p 8088 --with-threads --reload --debugger --debug
Owner after:
Modified-by after:
Noticed that I had a typo in the first sentence of the description. I wrote "modified-by" where I intended "owner" and vice-versa. Corrected in description.
@marre You are right, I deployed Superset using Helm on Kubernetes, and the latest version of Superset available in the official chart is 4.0.1. I will try to apply version 4.0.2
You have to either grab it directly from github from master branch or wait for a release where this PR will be included in. I hope it will be in 4.1.0 as it was once tagged with 4.1, but that tag has been removed. So I really don't know when this will be included in a release.