Skip to content

Commit

Permalink
chore: Cleanup table access check naming (#27772)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-bodley authored Apr 3, 2024
1 parent 5beda30 commit 27acc0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions superset/databases/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
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,
Expand Down Expand Up @@ -694,7 +694,7 @@ def tables(self, pk: int, **kwargs: Any) -> FlaskResponse:

@expose("/<int:pk>/table/<path:table_name>/<schema_name>/", methods=("GET",))
@protect()
@check_datasource_access
@check_table_access
@safe
@statsd_metrics
@event_logger.log_this_with_context(
Expand Down Expand Up @@ -757,7 +757,7 @@ def table_metadata(

@expose("/<int:pk>/table_extra/<path:table_name>/<schema_name>/", methods=("GET",))
@protect()
@check_datasource_access
@check_table_access
@safe
@statsd_metrics
@event_logger.log_this_with_context(
Expand Down Expand Up @@ -820,7 +820,7 @@ def table_extra_metadata(
@expose("/<int:pk>/select_star/<path:table_name>/", methods=("GET",))
@expose("/<int:pk>/select_star/<path:table_name>/<schema_name>/", methods=("GET",))
@protect()
@check_datasource_access
@check_table_access
@safe
@statsd_metrics
@event_logger.log_this_with_context(
Expand Down
4 changes: 2 additions & 2 deletions superset/databases/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
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(
Expand Down

0 comments on commit 27acc0b

Please sign in to comment.