You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2017/11/15 16:39:46 UTC
[incubator-superset] branch master updated: Filter out unavailable
databases (#3875)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new ae2205a Filter out unavailable databases (#3875)
ae2205a is described below
commit ae2205aeb54f43b63e58aadfbb5dd749e1c98d98
Author: Dmitry Goryunov <d....@gmail.com>
AuthorDate: Wed Nov 15 17:39:43 2017 +0100
Filter out unavailable databases (#3875)
---
superset/views/core.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/superset/views/core.py b/superset/views/core.py
index e5ae708..bebf17f 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -130,6 +130,14 @@ class SliceFilter(SupersetFilter):
return query.filter(self.model.perm.in_(perms))
+class DatabaseFilter(SupersetFilter):
+ def apply(self, query, func):
+ if self.has_all_datasource_access():
+ return query
+ perms = self.get_view_menus('database_access')
+ return query.filter(self.model.perm.in_(perms))
+
+
class DashboardFilter(SupersetFilter):
"""List dashboards for which users have access to at least one slice"""
@@ -203,6 +211,7 @@ class DatabaseView(SupersetModelView, DeleteMixin): # noqa
]
add_template = 'superset/models/database/add.html'
edit_template = 'superset/models/database/edit.html'
+ base_filters = [['perm', DatabaseFilter, lambda:[]]]
base_order = ('changed_on', 'desc')
description_columns = {
'sqlalchemy_uri': utils.markdown(
--
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <co...@superset.apache.org>'].