Skip to content

Commit

Permalink
fix: catalog permission check
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Jul 12, 2024
1 parent 84a1cd2 commit 09d8fc8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions superset/security/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ def get_catalogs_accessible_by_user(
if len(parts) == 2 and default_catalog:
accessible_catalogs.add(default_catalog)
elif len(parts) == 3:
accessible_catalogs.add(parts[2])
accessible_catalogs.add(parts[1])

# datasource_access
if perms := self.user_view_menu_names("datasource_access"):
Expand Down Expand Up @@ -911,7 +911,12 @@ def get_datasources_accessible_by_user( # pylint: disable=invalid-name
return datasource_names

if schema:
schema_perm = self.get_schema_perm(database, catalog, schema)
default_catalog = database.get_default_catalog()
schema_perm = self.get_schema_perm(
database.database_name,
catalog or default_catalog,
schema,
)
if schema_perm and self.can_access("schema_access", schema_perm):
return datasource_names

Expand Down

0 comments on commit 09d8fc8

Please sign in to comment.