You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2025/03/20 12:45:55 UTC
(superset) 14/17: fix: ensure datasource permission in explore (#32679)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 5.0
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 6917362d786850b4b8db678d8292eb3e7836f4d3
Author: Daniel Höxtermann <da...@hxtm.dev>
AuthorDate: Tue Mar 18 22:15:10 2025 +0100
fix: ensure datasource permission in explore (#32679)
(cherry picked from commit 9e3052968b8709ee4d9c35aef63c13abbc785233)
---
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(