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:11:04 UTC

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

john-bodley commented on code in PR #21931:
URL: https://github.com/apache/superset/pull/21931#discussion_r1004967380


##########
superset/reports/commands/execute.py:
##########
@@ -182,11 +193,11 @@ def _get_url(
                 **kwargs,
             )
 
-        # If we need to render dashboard in a specific sate, use stateful permalink
+        # If we need to render dashboard in a specific state, use stateful permalink
         dashboard_state = self._report_schedule.extra.get("dashboard")
         if dashboard_state:
             permalink_key = CreateDashboardPermalinkCommand(
-                dashboard_id=self._report_schedule.dashboard_id,
+                dashboard_id=str(self._report_schedule.dashboard_id),

Review Comment:
   Is Mypy not working as expected? Also why should the ID be a string?



##########
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:
   @villebro the walrus operator isn't supported in Python 3.8.



-- 
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