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/03/31 16:53:24 UTC

[GitHub] [superset] usmankhan-dataengineering commented on issue #5207: Database restriction in SQL Lab.

usmankhan-dataengineering commented on issue #5207:
URL: https://github.com/apache/superset/issues/5207#issuecomment-1084840523


   In databases/filter.py:
   
   
   ```
   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]
               for vm in security_manager.user_view_menu_names("schema_access")
           }
   
       def apply(self, query: Query, value: Any) -> Query:
           if security_manager.can_access_all_databases():
               return query
           # For returning only Database connection created by user
           return query.filter(Database.created_by_fk == g.user.id)
   ```
           
   It will restrict Database access to the user who created database connection        
           


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