You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ji...@apache.org on 2022/04/17 05:02:43 UTC
[superset] branch master updated: fix: remove expose (#19700)
This is an automated email from the ASF dual-hosted git repository.
jinghuayao 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 57157c8b15 fix: remove expose (#19700)
57157c8b15 is described below
commit 57157c8b1580545b5ef4d25a4d9039006bc27548
Author: AAfghahi <48...@users.noreply.github.com>
AuthorDate: Sun Apr 17 01:02:23 2022 -0400
fix: remove expose (#19700)
* bumping shillelagh
* remove expose
---
superset/databases/api.py | 5 +----
superset/databases/filters.py | 13 +------------
tests/integration_tests/databases/api_tests.py | 2 +-
3 files changed, 3 insertions(+), 17 deletions(-)
diff --git a/superset/databases/api.py b/superset/databases/api.py
index e5817afb5d..ac497bf67d 100644
--- a/superset/databases/api.py
+++ b/superset/databases/api.py
@@ -169,10 +169,7 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
edit_columns = add_columns
- search_filters = {
- "allow_file_upload": [DatabaseUploadEnabledFilter],
- "expose_in_sqllab": [DatabaseFilter],
- }
+ search_filters = {"allow_file_upload": [DatabaseUploadEnabledFilter]}
list_select_columns = list_columns + ["extra", "sqlalchemy_uri", "password"]
order_columns = [
diff --git a/superset/databases/filters.py b/superset/databases/filters.py
index 228abbc3bf..86564e8f15 100644
--- a/superset/databases/filters.py
+++ b/superset/databases/filters.py
@@ -69,8 +69,6 @@ class DatabaseUploadEnabledFilter(BaseFilter): # pylint: disable=too-few-public
def apply(self, query: Query, value: Any) -> Query:
filtered_query = query.filter(Database.allow_file_upload)
- database_perms = security_manager.user_view_menu_names("database_access")
- schema_access_databases = can_access_databases("schema_access")
datasource_access_databases = can_access_databases("datasource_access")
if hasattr(g, "user"):
@@ -82,19 +80,10 @@ class DatabaseUploadEnabledFilter(BaseFilter): # pylint: disable=too-few-public
if len(allowed_schemas):
return filtered_query
- filtered_query = filtered_query.filter(
+ return filtered_query.filter(
or_(
cast(Database.extra, JSON)["schemas_allowed_for_file_upload"]
is not None,
cast(Database.extra, JSON)["schemas_allowed_for_file_upload"] != [],
)
)
-
- return filtered_query.filter(
- or_(
- self.model.perm.in_(database_perms),
- self.model.database_name.in_(
- [*schema_access_databases, *datasource_access_databases]
- ),
- )
- )
diff --git a/tests/integration_tests/databases/api_tests.py b/tests/integration_tests/databases/api_tests.py
index 0c1dc27538..70640728ac 100644
--- a/tests/integration_tests/databases/api_tests.py
+++ b/tests/integration_tests/databases/api_tests.py
@@ -1135,7 +1135,7 @@ class TestDatabaseApi(SupersetTestCase):
uri = f"api/v1/database/?q={prison.dumps(arguments)}"
rv = self.client.get(uri)
data = json.loads(rv.data.decode("utf-8"))
- assert data["count"] == 0
+ assert data["count"] == 1
def test_get_allow_file_upload_filter_no_permission(self):
"""