You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/01/27 10:50:18 UTC

[GitHub] [superset] villebro commented on a change in pull request #18064: feat: datasource access to allow more granular access to tables on SQL Lab

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



##########
File path: superset/databases/filters.py
##########
@@ -27,19 +27,30 @@ class DatabaseFilter(BaseFilter):
     # TODO(bogdan): consider caching.
     def schema_access_databases(self) -> Set[str]:  # noqa pylint: disable=no-self-use
         return {
-            security_manager.unpack_schema_perm(vm)[0]
+            security_manager.unpack_perm(vm)[0]
             for vm in security_manager.user_view_menu_names("schema_access")
         }
 
+    def datasource_access_databases(  # noqa pylint: disable=no-self-use
+        self,
+    ) -> Set[str]:
+        return {
+            security_manager.unpack_perm(vm)[0]

Review comment:
       nit: not something you introduced, but while we're touching up the code and for readability's sake, it would be nice to use a `NamedTuple` or `@dataclass` as the return type in `unpack_perm` so we can replace `[0]` with `.database_name` here and `[1]` with `.schema_name` when requesting the schema name.




-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org