Skip to content

Commit

Permalink
fix: Fixing schemas_allowed_for_upload field in database connection…
Browse files Browse the repository at this point in the history
… UX (#15750)
  • Loading branch information
hughhhh committed Jul 19, 2021
1 parent 281cb92 commit 7d0f6ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -257,9 +257,8 @@ function dbReducer(
...JSON.parse(action.payload.extra || ''),
metadata_params: JSON.stringify(extra_json?.metadata_params),
engine_params: JSON.stringify(extra_json?.engine_params),
schemas_allowed_for_csv_upload: JSON.stringify(
schemas_allowed_for_csv_upload:
extra_json?.schemas_allowed_for_csv_upload,
),
};
}

Expand Down
5 changes: 5 additions & 0 deletions superset/models/core.py
Expand Up @@ -20,6 +20,7 @@
import json
import logging
import textwrap
from ast import literal_eval
from contextlib import closing
from copy import deepcopy
from datetime import datetime
Expand Down Expand Up @@ -668,6 +669,10 @@ def get_schema_access_for_csv_upload( # pylint: disable=invalid-name
self,
) -> List[str]:
allowed_databases = self.get_extra().get("schemas_allowed_for_csv_upload", [])

if isinstance(allowed_databases, str):
allowed_databases = literal_eval(allowed_databases)

if hasattr(g, "user"):
extra_allowed_databases = config["ALLOWED_USER_CSV_SCHEMA_FUNC"](
self, g.user
Expand Down

0 comments on commit 7d0f6ab

Please sign in to comment.