villebro commented on a change in pull request #13992:
URL: https://github.com/apache/superset/pull/13992#discussion_r609427261



##########
File path: superset/security/manager.py
##########
@@ -61,7 +62,6 @@
     from superset.sql_parse import Table
     from superset.viz import BaseViz
 
-

Review comment:
       Nit: this probably won't pass linting

##########
File path: superset/security/manager.py
##########
@@ -994,8 +994,14 @@ def raise_for_access(  # pylint: 
disable=too-many-arguments,too-many-branches
 
             assert datasource
 
+            from superset import is_feature_enabled

Review comment:
       I think this is the old way of importing. I believe the correct way is
   ```suggestion
               from superset.extensions import feature_flag_manager
   ```
   and then doing `feature_flag_manager.is_feature_enabled`

##########
File path: superset/security/manager.py
##########
@@ -1125,3 +1131,20 @@ def raise_for_dashboard_access(self, dashboard: 
"Dashboard") -> None:
 
             if not can_access:
                 raise DashboardAccessDeniedError()
+
+    # pylint: disable=no-self-use
+    def can_access_based_on_dashboard(self, datasource: "BaseDatasource"):
+        from superset import db
+        from superset.dashboards.filters import DashboardFilter
+        from superset.models.slice import Slice
+        from superset.models.dashboard import Dashboard
+
+        TBL = ConnectorRegistry.sources["table"]
+        query = db.session.query(TBL).join(Slice.table).filter(TBL.id == 
datasource.id)

Review comment:
       Can't we make this generic by doing the following:
   
   ```python
   datasource_class = type(datasource)
   ```




-- 
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.

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