eschutho commented on code in PR #19981:
URL: https://github.com/apache/superset/pull/19981#discussion_r872891741


##########
superset/explore/utils.py:
##########
@@ -24,15 +24,24 @@
     ChartNotFoundError,
 )
 from superset.charts.dao import ChartDAO
+from superset.commands.exceptions import DatasourceNotFoundValidationError
 from superset.datasets.commands.exceptions import (
     DatasetAccessDeniedError,
     DatasetNotFoundError,
 )
 from superset.datasets.dao import DatasetDAO
+from superset.utils.core import DatasourceType
 from superset.views.base import is_user_admin
 from superset.views.utils import is_owner
 
 
+def check_datasource_access(datasource_id: int, datasource_type: str) -> 
Optional[bool]:
+    if datasource_id:
+        if datasource_type == DatasourceType.TABLE:

Review Comment:
   Right now, it's not dependent because there's only one type, but when we 
start adding other types, we'll do something like this: 
   ```
   def check_query_access(query_id: int) -> Optional[bool]:
       if query_id:
           query = QueryDAO.find_by_id(query_id)
           if query:
               can_access_datasource = security_manager.raise_for_access(
                   query=query)
               if can_access_datasource:
                   return True
       raise QueryNotFoundError
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to