mirror of https://github.com/apache/superset.git
make filters use security manager (#5567)
* make filters use security manager * remove the superset short-circuit
This commit is contained in:
parent
32b3d00825
commit
4ff5686e0c
|
@ -256,15 +256,10 @@ class SupersetFilter(BaseFilter):
|
||||||
vm.add(vm_name)
|
vm.add(vm_name)
|
||||||
return vm
|
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):
|
class DatasourceFilter(SupersetFilter):
|
||||||
def apply(self, query, func): # noqa
|
def apply(self, query, func): # noqa
|
||||||
if self.has_all_datasource_access():
|
if security_manager.all_datasource_access():
|
||||||
return query
|
return query
|
||||||
perms = self.get_view_menus('datasource_access')
|
perms = self.get_view_menus('datasource_access')
|
||||||
# TODO(bogdan): add `schema_access` support here
|
# TODO(bogdan): add `schema_access` support here
|
||||||
|
|
|
@ -97,7 +97,7 @@ def is_owner(obj, user):
|
||||||
|
|
||||||
class SliceFilter(SupersetFilter):
|
class SliceFilter(SupersetFilter):
|
||||||
def apply(self, query, func): # noqa
|
def apply(self, query, func): # noqa
|
||||||
if self.has_all_datasource_access():
|
if security_manager.all_datasource_access():
|
||||||
return query
|
return query
|
||||||
perms = self.get_view_menus('datasource_access')
|
perms = self.get_view_menus('datasource_access')
|
||||||
# TODO(bogdan): add `schema_access` support here
|
# 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"""
|
"""List dashboards for which users have access to at least one slice or are owners"""
|
||||||
|
|
||||||
def apply(self, query, func): # noqa
|
def apply(self, query, func): # noqa
|
||||||
if self.has_all_datasource_access():
|
if security_manager.all_datasource_access():
|
||||||
return query
|
return query
|
||||||
Slice = models.Slice # noqa
|
Slice = models.Slice # noqa
|
||||||
Dash = models.Dashboard # noqa
|
Dash = models.Dashboard # noqa
|
||||||
|
|
Loading…
Reference in New Issue