This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 9e3052968b fix: ensure datasource permission in explore (#32679)
9e3052968b is described below

commit 9e3052968b8709ee4d9c35aef63c13abbc785233
Author: Daniel Höxtermann <[email protected]>
AuthorDate: Tue Mar 18 22:15:10 2025 +0100

    fix: ensure datasource permission in explore (#32679)
---
 superset/commands/explore/get.py             | 2 +-
 tests/integration_tests/explore/api_tests.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/superset/commands/explore/get.py b/superset/commands/explore/get.py
index dc600bbf97..df71a931b2 100644
--- a/superset/commands/explore/get.py
+++ b/superset/commands/explore/get.py
@@ -120,7 +120,7 @@ class GetExploreCommand(BaseCommand, ABC):
 
         if datasource:
             datasource_name = datasource.name
-            security_manager.can_access_datasource(datasource)
+            security_manager.raise_for_access(datasource=datasource)
 
         viz_type = form_data.get("viz_type")
         if not viz_type and datasource and datasource.default_endpoint:
diff --git a/tests/integration_tests/explore/api_tests.py 
b/tests/integration_tests/explore/api_tests.py
index 730e013f82..cc65870ca6 100644
--- a/tests/integration_tests/explore/api_tests.py
+++ b/tests/integration_tests/explore/api_tests.py
@@ -214,12 +214,12 @@ def test_get_dataset_access_denied_with_form_data_key(
     assert data["message"] == message
 
 
-@patch("superset.security.SupersetSecurityManager.can_access_datasource")
+@patch("superset.security.SupersetSecurityManager.raise_for_access")
 def test_get_dataset_access_denied(
-    mock_can_access_datasource, test_client, login_as_admin, dataset
+    mock_raise_for_access, test_client, login_as_admin, dataset
 ):
     message = "Dataset access denied"
-    mock_can_access_datasource.side_effect = DatasetAccessDeniedError(
+    mock_raise_for_access.side_effect = DatasetAccessDeniedError(
         message=message, datasource_id=dataset.id, datasource_type=dataset.type
     )
     resp = test_client.get(

Reply via email to