You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/10/25 21:12:49 UTC

[GitHub] [superset] villebro commented on a diff in pull request #21931: [WIP] feat(reports): execute as other than selenium user

villebro commented on code in PR #21931:
URL: https://github.com/apache/superset/pull/21931#discussion_r1004969438


##########
superset/reports/commands/execute.py:
##########
@@ -77,11 +77,22 @@
 logger = logging.getLogger(__name__)
 
 
-def _get_user() -> User:
-    user = security_manager.find_user(username=app.config["THUMBNAIL_SELENIUM_USER"])
-    if not user:
-        raise ReportScheduleSelleniumUserNotFoundError()
-    return user
+def _get_user(report_schedule: ReportSchedule) -> User:
+    user_types = app.config["ALERT_REPORTS_EXECUTE_AS"]
+    for user_type in user_types:
+        if user_type == "selenium":
+            return app.config["THUMBNAIL_SELENIUM_USER"]
+        if user_type == "creator":
+            if user := report_schedule.created_by:

Review Comment:
   Hmm, I do believe it is: https://docs.python.org/3/whatsnew/3.8.html#assignment-expressions



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org