def apply(self, query: Query, value: Any) -> Query: if security_manager.all_database_access(): return query database_perms = security_manager.user_view_menu_names( "database_access") # TODO(bogdan): consider adding datasource access here as well. schema_access_databases = self.schema_access_databases() return query.filter( or_( self.model.perm.in_(database_perms), self.model.database_name.in_(schema_access_databases), ))
def apply(self, query, func): # noqa pylint: disable=unused-argument,arguments-differ if security_manager.all_database_access(): return query database_perms = security_manager.user_view_menu_names( "database_access") # TODO(bogdan): consider adding datasource access here as well. schema_access_databases = self.schema_access_databases() return query.filter( or_( self.model.perm.in_(database_perms), self.model.database_name.in_(schema_access_databases), ))
def apply(self, query, func): # noqa if security_manager.all_database_access(): return query perms = self.get_view_menus("database_access") return query.filter(self.model.perm.in_(perms))