superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [incubator-superset] branch master updated: make filters use security manager (#5567)
Date Thu, 16 Aug 2018 21:17:47 GMT
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


Mime
View raw message