From commits-return-1325-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Thu Aug 16 23:17:49 2018 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 [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C880B180675 for ; Thu, 16 Aug 2018 23:17:48 +0200 (CEST) Received: (qmail 9189 invoked by uid 500); 16 Aug 2018 21:17:48 -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 9179 invoked by uid 99); 16 Aug 2018 21:17:47 -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; Thu, 16 Aug 2018 21:17:47 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 6CA4C88BFC; Thu, 16 Aug 2018 21:17:47 +0000 (UTC) Date: Thu, 16 Aug 2018 21:17:47 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: make filters use security manager (#5567) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <153445426723.16304.9236724114073238569@gitbox.apache.org> From: timi@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-superset X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 32b3d008251eeda21cb7c90a90a48d8c3e9822cf X-Git-Newrev: 4ff5686e0c5f2f7f97de68590377d8c77e4f5f6a X-Git-Rev: 4ff5686e0c5f2f7f97de68590377d8c77e4f5f6a 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. timi 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 4ff5686 make filters use security manager (#5567) 4ff5686 is described below commit 4ff5686e0c5f2f7f97de68590377d8c77e4f5f6a Author: timifasubaa <30888507+timifasubaa@users.noreply.github.com> AuthorDate: Thu Aug 16 14:17:41 2018 -0700 make filters use security manager (#5567) * make filters use security manager * remove the superset short-circuit --- superset/views/base.py | 7 +------ superset/views/core.py | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/superset/views/base.py b/superset/views/base.py index ec31d9b..217415a 100644 --- a/superset/views/base.py +++ b/superset/views/base.py @@ -256,15 +256,10 @@ class SupersetFilter(BaseFilter): vm.add(vm_name) return vm - def has_all_datasource_access(self): - return ( - self.has_role(['Admin', 'Alpha']) or - self.has_perm('all_datasource_access', 'all_datasource_access')) - class DatasourceFilter(SupersetFilter): def apply(self, query, func): # noqa - if self.has_all_datasource_access(): + if security_manager.all_datasource_access(): return query perms = self.get_view_menus('datasource_access') # TODO(bogdan): add `schema_access` support here diff --git a/superset/views/core.py b/superset/views/core.py index c849ede..2b6924d 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -97,7 +97,7 @@ def is_owner(obj, user): class SliceFilter(SupersetFilter): def apply(self, query, func): # noqa - if self.has_all_datasource_access(): + if security_manager.all_datasource_access(): return query perms = self.get_view_menus('datasource_access') # TODO(bogdan): add `schema_access` support here @@ -109,7 +109,7 @@ class DashboardFilter(SupersetFilter): """List dashboards for which users have access to at least one slice or are owners""" def apply(self, query, func): # noqa - if self.has_all_datasource_access(): + if security_manager.all_datasource_access(): return query Slice = models.Slice # noqa Dash = models.Dashboard # noqa