superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From christ...@apache.org
Subject [incubator-superset] branch lyftga updated: Revert "Fix issues around Database permissions (#7009)" (#7267)
Date Wed, 10 Apr 2019 03:39:32 GMT
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 <roberto@dealmeida.net>
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)


Mime
View raw message