From commits-return-2538-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Wed Apr 10 03:39:34 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 19CE0180629 for ; Wed, 10 Apr 2019 05:39:34 +0200 (CEST) Received: (qmail 96029 invoked by uid 500); 10 Apr 2019 03:39:33 -0000 Mailing-List: contact commits-help@superset.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@superset.incubator.apache.org Delivered-To: mailing list commits@superset.incubator.apache.org Received: (qmail 96020 invoked by uid 99); 10 Apr 2019 03:39:33 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Apr 2019 03:39:33 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 06B6780B36; Wed, 10 Apr 2019 03:39:33 +0000 (UTC) Date: Wed, 10 Apr 2019 03:39:32 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch lyftga updated: Revert "Fix issues around Database permissions (#7009)" (#7267) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155486757242.22116.5779324170528267325@gitbox.apache.org> From: christine@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-superset X-Git-Refname: refs/heads/lyftga X-Git-Reftype: branch X-Git-Oldrev: 984b04d1e5251702170af143ebd373393811af8c X-Git-Newrev: e505e326b22b47c2f25ec6c69310b93ab5d28fda X-Git-Rev: e505e326b22b47c2f25ec6c69310b93ab5d28fda X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. christine pushed a commit to branch lyftga in repository https://gitbox.apache.org/repos/asf/incubator-superset.git The following commit(s) were added to refs/heads/lyftga by this push: new e505e32 Revert "Fix issues around Database permissions (#7009)" (#7267) e505e32 is described below commit e505e326b22b47c2f25ec6c69310b93ab5d28fda Author: Beto Dealmeida AuthorDate: Tue Apr 9 20:39:24 2019 -0700 Revert "Fix issues around Database permissions (#7009)" (#7267) This reverts commit f5274a9c7f437dcf9359f8dc5fdd056c23bf03b8. --- superset/security.py | 12 +++--------- superset/views/core.py | 9 --------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/superset/security.py b/superset/security.py index 3a766d4..35545f2 100644 --- a/superset/security.py +++ b/superset/security.py @@ -106,10 +106,8 @@ class SupersetSecurityManager(SecurityManager): return self._has_view_access(user, permission_name, view_name) def all_datasource_access(self): - return self.can_access('all_datasource_access', 'all_datasource_access') - - def all_database_access(self): - return self.can_access('all_database_access', 'all_database_access') + return self.can_access( + 'all_datasource_access', 'all_datasource_access') def database_access(self, database): return ( @@ -411,12 +409,8 @@ class SupersetSecurityManager(SecurityManager): .values(perm=target.get_perm()), ) - permission_name = 'datasource_access' - from superset.models.core import Database - if mapper.class_ == Database: - permission_name = 'database_access' - # add to view menu if not already exists + permission_name = 'datasource_access' view_menu_name = target.get_perm() permission = self.find_permission(permission_name) view_menu = self.find_view_menu(view_menu_name) diff --git a/superset/views/core.py b/superset/views/core.py index 61fde62..becc1b1 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -141,14 +141,6 @@ def check_slice_perms(self, slice_id): security_manager.assert_datasource_permission(viz_obj.datasource) -class DatabaseFilter(SupersetFilter): - def apply(self, query, func): # noqa - if security_manager.all_database_access(): - return query - database_perms = self.get_view_menus('database_access') - return query.filter(self.model.perm.in_(database_perms)) - - class SliceFilter(SupersetFilter): def apply(self, query, func): # noqa if security_manager.all_datasource_access(): @@ -311,7 +303,6 @@ class DatabaseView(SupersetModelView, DeleteMixin, YamlExportMixin): # noqa 'allow_multi_schema_metadata_fetch': _('Allow Multi Schema Metadata Fetch'), 'backend': _('Backend'), } - base_filters = [['id', DatabaseFilter, lambda: []]] def pre_add(self, db): self.check_extra(db)