john-bodley commented on a change in pull request #15184:
URL: https://github.com/apache/superset/pull/15184#discussion_r660129674



##########
File path: superset/connectors/connector_registry.py
##########
@@ -99,6 +100,41 @@ def get_datasource_by_id(  # pylint: 
disable=too-many-arguments
                 pass
         raise NoResultFound(_("Datasource id not found: %(id)s", 
id=datasource_id))
 
+    @classmethod
+    def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+        from superset import security_manager
+
+        # collect datasources which the user has explicit permissions to
+        user_perms = security_manager.user_view_menu_names("datasource_access")
+        schema_perms = security_manager.user_view_menu_names("schema_access")
+        user_datasources = set()
+        for datasource_class in ConnectorRegistry.sources.values():
+            user_datasources.update(
+                session.query(datasource_class)

Review comment:
       @dpgaspar that's correct. We actually don't use any of the FAB logic and 
thus we completely bypass the `securiy_manager.user_view_menu_names` and 
reliance of  the `datasource_class.perm` and `datasource_class.schema_perm` 
database columns.




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