From 7ab62e1aaa03b01f8ecb2a5accf9e31b4566359a Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Thu, 15 Feb 2024 16:26:33 -0500 Subject: [PATCH] fix: Plain error message when visiting a dashboard via permalink without permissions (#27132) --- superset/views/core.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/superset/views/core.py b/superset/views/core.py index 9ad2f63fdc680..3e895e6b4b465 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -47,6 +47,7 @@ from superset.commands.chart.exceptions import ChartNotFoundError from superset.commands.chart.warm_up_cache import ChartWarmUpCacheCommand from superset.commands.dashboard.importers.v0 import ImportDashboardsCommand +from superset.commands.dashboard.exceptions import DashboardAccessDeniedError from superset.commands.dashboard.permalink.get import GetDashboardPermalinkCommand from superset.commands.dataset.exceptions import DatasetNotFoundError from superset.commands.explore.form_data.create import CreateFormDataCommand @@ -880,6 +881,9 @@ def dashboard_permalink( except DashboardPermalinkGetFailedError as ex: flash(__("Error: %(msg)s", msg=ex.message), "danger") return redirect("/dashboard/list/") + except DashboardAccessDeniedError as ex: + flash(__("Error: %(msg)s", msg=ex.message), "danger") + return redirect("/dashboard/list/") if not value: return json_error_response(_("permalink state not found"), status=404) dashboard_id, state = value["dashboardId"], value.get("state", {})