fix: Refactor ownership checks and ensure consistency (#20499)

Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
John Bodley
2022-07-07 11:04:27 -07:00
committed by GitHub
parent e7b965a3b2
commit f0ca158989
107 changed files with 614 additions and 807 deletions

View File

@@ -17,7 +17,6 @@
import logging
from typing import Optional
from flask_appbuilder.security.sqla.models import User
from sqlalchemy.exc import SQLAlchemyError
from superset.datasets.commands.exceptions import DatasetNotFoundError
@@ -34,8 +33,7 @@ logger = logging.getLogger(__name__)
class GetExplorePermalinkCommand(BaseExplorePermalinkCommand):
def __init__(self, actor: User, key: str):
self.actor = actor
def __init__(self, key: str):
self.key = key
def run(self) -> Optional[ExplorePermalinkValue]:
@@ -55,7 +53,7 @@ class GetExplorePermalinkCommand(BaseExplorePermalinkCommand):
datasource_type = DatasourceType(
value.get("datasourceType", DatasourceType.TABLE)
)
check_chart_access(datasource_id, chart_id, self.actor, datasource_type)
check_chart_access(datasource_id, chart_id, datasource_type)
return value
return None
except (