sadpandajoe commented on code in PR #45698:
URL: https://github.com/apache/superset/pull/45698#discussion_r4379680869


##########
superset/commands/report/execute.py:
##########
@@ -791,17 +802,55 @@ def _get_url(
         ):
             return self._get_tab_url(dashboard_state, 
user_friendly=user_friendly)
 
+        return self._get_plain_dashboard_url(user_friendly=user_friendly, 
**kwargs)
+
+    def _get_plain_dashboard_url(
+        self, user_friendly: bool = False, **kwargs: Any
+    ) -> str:
+        """Return the dashboard URL without any stored permalink state."""
+        dashboard = self._report_schedule.dashboard
         dashboard_id_or_slug = (
             dashboard.uuid if dashboard.uuid is not None else dashboard.id
         )
         return get_url_path(
             "Superset.dashboard",
             user_friendly=user_friendly,
             dashboard_id_or_slug=dashboard_id_or_slug,
-            force=force,
+            force=self._get_force_param(),
             **kwargs,
         )
 
+    def _get_failure_notification_url(self) -> str:
+        """
+        Return the link for a failure notification.
+
+        The stateful link is a permalink created as the executor. When the
+        executor cannot access the dashboard, that is the very failure being
+        reported, so link to the dashboard itself rather than letting the
+        notification fail too.
+        """
+        try:
+            return self._get_url(user_friendly=True)
+        except ReportScheduleExecutorAccessDeniedError:
+            return self._get_plain_dashboard_url(user_friendly=True)
+
+    def _raise_for_executor_dashboard_access(self) -> None:
+        """
+        Fail with an actionable error when the executor cannot see the 
dashboard.
+
+        Without this, a plain dashboard URL renders the not-found page for the
+        executor and surfaces only as a generic screenshot failure.
+        """
+        user = get_user()
+        if user is None or getattr(user, "is_anonymous", False):
+            return
+        try:
+            
security_manager.raise_for_access(dashboard=self._report_schedule.dashboard)

Review Comment:
   Confirmed, and fixed in 0ed1af38a8. `raise_for_access` does not consult 
`EXTRA_ACCESS_QUERY_EXCLUSIONS`, but `DashboardDAO.get_by_id_or_slug` (used by 
the permalink command) does, so an executor the hook withholds the dashboard 
from passed both checks and then hit an unhandled `DashboardNotFoundError` 
before the claim. Now a withheld dashboard is treated as an executor access 
denial: `validate_executor_target_access` rejects it at save time, and 
`_raise_for_executor_dashboard_access` raises 
`ReportScheduleExecutorAccessDeniedError` before any permalink is built (covers 
single-tab, multi-tab and plain-URL paths), so the state machine records and 
notifies. Regression tests added in `executor_target_access_test.py`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to