You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2026/06/29 22:08:36 UTC

(superset) branch master updated: fix(datasource): allow Gamma to load combined datasource list (#41553)

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

villebro 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 ece8d8ffca5 fix(datasource): allow Gamma to load combined datasource list (#41553)
ece8d8ffca5 is described below

commit ece8d8ffca5b67bf39b3c52881ab5fa66828f631
Author: Ville Brofeldt <33...@users.noreply.github.com>
AuthorDate: Mon Jun 29 15:08:29 2026 -0700

    fix(datasource): allow Gamma to load combined datasource list (#41553)
---
 superset/datasource/api.py                      |  3 +++
 tests/integration_tests/datasource/api_tests.py | 28 ++++++++++++++-----------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/superset/datasource/api.py b/superset/datasource/api.py
index 69ad1e34181..f04db51e886 100644
--- a/superset/datasource/api.py
+++ b/superset/datasource/api.py
@@ -45,6 +45,9 @@ logger = logging.getLogger(__name__)
 class DatasourceRestApi(BaseSupersetApi):
     allow_browser_login = True
     class_permission_name = "Datasource"
+    method_permission_name = {
+        "combined_list": "read",
+    }
     resource_name = "datasource"
     openapi_spec_tag = "Datasources"
 
diff --git a/tests/integration_tests/datasource/api_tests.py b/tests/integration_tests/datasource/api_tests.py
index c767cbfaca2..335f09ea47f 100644
--- a/tests/integration_tests/datasource/api_tests.py
+++ b/tests/integration_tests/datasource/api_tests.py
@@ -339,12 +339,6 @@ class TestDatasourceApi(SupersetTestCase):
         run_mock,
         can_access_mock,
     ):
-        security_manager.add_permission_view_menu("can_combined_list", "Datasource")
-        perm = security_manager.find_permission_view_menu(
-            "can_combined_list", "Datasource"
-        )
-        admin_role = security_manager.find_role("Admin")
-        security_manager.add_permission_role(admin_role, perm)
         can_access_mock.side_effect = [True, True]
         run_mock.side_effect = ValueError("Invalid order column: invalid")
         self.login(ADMIN_USERNAME)
@@ -364,12 +358,6 @@ class TestDatasourceApi(SupersetTestCase):
         run_mock,
         can_access_mock,
     ):
-        security_manager.add_permission_view_menu("can_combined_list", "Datasource")
-        perm = security_manager.find_permission_view_menu(
-            "can_combined_list", "Datasource"
-        )
-        admin_role = security_manager.find_role("Admin")
-        security_manager.add_permission_role(admin_role, perm)
         can_access_mock.return_value = True
         run_mock.return_value = {"count": 1, "result": []}
         self.login(ADMIN_USERNAME)
@@ -383,3 +371,19 @@ class TestDatasourceApi(SupersetTestCase):
         run_mock.assert_called_once()
         _, kwargs = run_mock.call_args
         assert kwargs == {}
+
+    @patch("superset.datasource.api.GetCombinedDatasourceListCommand.run")
+    def test_combined_list_gamma_uses_read_permission(self, run_mock):
+        run_mock.return_value = {"count": 0, "result": []}
+        self.login(GAMMA_USERNAME)
+
+        rv = self.client.get(
+            "api/v1/datasource/?q="
+            "(order_column:changed_on_delta_humanized,"
+            "order_direction:desc,page:0,page_size:25)"
+        )
+
+        assert rv.status_code == 200
+        response = json.loads(rv.data.decode("utf-8"))
+        assert response == {"count": 0, "result": []}
+        run_mock.assert_called_once()