From 27acc0b13399e0709f47bd156eb4b02b1e3643d4 Mon Sep 17 00:00:00 2001 From: John Bodley <4567245+john-bodley@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:02:00 -0700 Subject: [PATCH] chore: Cleanup table access check naming (#27772) --- superset/databases/api.py | 8 ++++---- superset/databases/decorators.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/superset/databases/api.py b/superset/databases/api.py index 40980dc87a..ce83f0de59 100644 --- a/superset/databases/api.py +++ b/superset/databases/api.py @@ -63,7 +63,7 @@ from superset.commands.importers.exceptions import ( from superset.commands.importers.v1.utils import get_contents_from_bundle from superset.constants import MODEL_API_RW_METHOD_PERMISSION_MAP, RouteMethod from superset.daos.database import DatabaseDAO, DatabaseUserOAuth2TokensDAO -from superset.databases.decorators import check_datasource_access +from superset.databases.decorators import check_table_access from superset.databases.filters import DatabaseFilter, DatabaseUploadEnabledFilter from superset.databases.schemas import ( database_schemas_query_schema, @@ -694,7 +694,7 @@ class DatabaseRestApi(BaseSupersetModelRestApi): @expose("//table///", methods=("GET",)) @protect() - @check_datasource_access + @check_table_access @safe @statsd_metrics @event_logger.log_this_with_context( @@ -757,7 +757,7 @@ class DatabaseRestApi(BaseSupersetModelRestApi): @expose("//table_extra///", methods=("GET",)) @protect() - @check_datasource_access + @check_table_access @safe @statsd_metrics @event_logger.log_this_with_context( @@ -820,7 +820,7 @@ class DatabaseRestApi(BaseSupersetModelRestApi): @expose("//select_star//", methods=("GET",)) @expose("//select_star///", methods=("GET",)) @protect() - @check_datasource_access + @check_table_access @safe @statsd_metrics @event_logger.log_this_with_context( diff --git a/superset/databases/decorators.py b/superset/databases/decorators.py index 1d49a65d5e..b3b4f18342 100644 --- a/superset/databases/decorators.py +++ b/superset/databases/decorators.py @@ -30,9 +30,9 @@ from superset.views.base_api import BaseSupersetModelRestApi logger = logging.getLogger(__name__) -def check_datasource_access(f: Callable[..., Any]) -> Callable[..., Any]: +def check_table_access(f: Callable[..., Any]) -> Callable[..., Any]: """ - A Decorator that checks if a user has datasource access + A Decorator that checks if a user has access to a table in a database. """ def wraps(