This is an automated email from the ASF dual-hosted git repository. bkyryliuk pushed a commit to branch release/3.1.0.rc4 in repository https://gitbox.apache.org/repos/asf/superset.git
commit 9ecf5dc990b29d63e3d16cfee6dbc37038c25839 Author: Bogdan <[email protected]> AuthorDate: Mon Feb 12 19:10:21 2024 -0800 Show report and alerts to all users based on config --- superset/config.py | 2 ++ superset/reports/filters.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/superset/config.py b/superset/config.py index ca801442d9..138df6cc1c 100644 --- a/superset/config.py +++ b/superset/config.py @@ -1328,6 +1328,8 @@ ALERT_REPORTS_QUERY_EXECUTION_MAX_TRIES = 1 ALERT_REPORTS_MIN_CUSTOM_SCREENSHOT_WIDTH = 600 ALERT_REPORTS_MAX_CUSTOM_SCREENSHOT_WIDTH = 2400 +ALERT_REPORTS_READ_ONLY_FULL_ACCESS = False + # A custom prefix to use on all Alerts & Reports emails EMAIL_REPORTS_SUBJECT_PREFIX = "[Report] " diff --git a/superset/reports/filters.py b/superset/reports/filters.py index a03238b640..e1733a145c 100644 --- a/superset/reports/filters.py +++ b/superset/reports/filters.py @@ -20,15 +20,22 @@ from flask_babel import lazy_gettext as _ from sqlalchemy import or_ from sqlalchemy.orm.query import Query -from superset import db, security_manager +from superset import app, db, security_manager from superset.reports.models import ReportSchedule from superset.views.base import BaseFilter +config = app.config + + class ReportScheduleFilter(BaseFilter): # pylint: disable=too-few-public-methods def apply(self, query: Query, value: Any) -> Query: if security_manager.can_access_all_datasources(): return query + + # show reports and alerts to all users regardless ownership + if config["ALERT_REPORTS_READ_ONLY_FULL_ACCESS"]: + return query owner_ids_query = ( db.session.query(ReportSchedule.id) .join(ReportSchedule.owners)
