rusackas commented on code in PR #40769:
URL: https://github.com/apache/superset/pull/40769#discussion_r3488819015


##########
tests/integration_tests/core_tests.py:
##########
@@ -937,6 +938,36 @@ def test_dashboard_permalink_native_filters_encoded(
         parsed = parse_qs(urlsplit(location).query)
         assert parsed["native_filters"] == [native_filters_value]
 
+    @mock.patch(
+        
"superset.commands.dashboard.permalink.get.GetDashboardPermalinkCommand.run"
+    )
+    def test_dashboard_permalink_redirects_anonymous_access_denied(
+        self,
+        get_dashboard_permalink_mock,
+    ):

Review Comment:
   The neighboring test methods here aren't typed either, so this just matches 
the convention in the file. Inclined to leave it... won't lose sleep over that 
one.



##########
superset/views/core.py:
##########
@@ -853,7 +853,11 @@ def dashboard_permalink(
     ) -> FlaskResponse:
         try:
             value = GetDashboardPermalinkCommand(key).run()
-        except (DashboardPermalinkGetFailedError, DashboardAccessDeniedError) 
as ex:
+        except DashboardAccessDeniedError as ex:
+            if not get_current_user():
+                return redirect_to_login()
+            return json_error_response(__("Error: %(msg)s", msg=ex.message), 
status=404)

Review Comment:
   Agreed, this is pre-existing, the PR doesn't change the authenticated path. 
We could align it with the bare `abort(404)` the regular dashboard route uses 
so it stops echoing the access message, but that's a separate follow-up rather 
than something to hold this up for.



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