mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: all_database_access should enable access to all datasets/charts/dashboards (#28205)
This commit is contained in:
committed by
GitHub
parent
e94360486e
commit
513852b7c3
@@ -189,6 +189,40 @@ class TestDatasetApi(SupersetTestCase):
|
||||
buf.seek(0)
|
||||
return buf
|
||||
|
||||
@pytest.mark.usefixtures("load_energy_table_with_slice")
|
||||
def test_user_gets_all_datasets(self):
|
||||
# test filtering on datasource_name
|
||||
gamma_user = security_manager.find_user(username="gamma")
|
||||
|
||||
def count_datasets():
|
||||
uri = "api/v1/chart/"
|
||||
rv = self.client.get(uri, "get_list")
|
||||
print(rv.data)
|
||||
self.assertEqual(rv.status_code, 200)
|
||||
data = rv.get_json()
|
||||
return data["count"]
|
||||
|
||||
with self.temporary_user(gamma_user, login=True) as user:
|
||||
assert count_datasets() == 0
|
||||
|
||||
all_db_pvm = ("all_database_access", "all_database_access")
|
||||
with self.temporary_user(
|
||||
gamma_user, extra_pvms=[all_db_pvm], login=True
|
||||
) as user:
|
||||
self.login(username=user.username)
|
||||
assert count_datasets() > 0
|
||||
|
||||
all_db_pvm = ("all_datasource_access", "all_datasource_access")
|
||||
with self.temporary_user(
|
||||
gamma_user, extra_pvms=[all_db_pvm], login=True
|
||||
) as user:
|
||||
self.login(username=user.username)
|
||||
assert count_datasets() > 0
|
||||
|
||||
# Back to normal
|
||||
with self.temporary_user(gamma_user, login=True):
|
||||
assert count_datasets() == 0
|
||||
|
||||
def test_get_dataset_list(self):
|
||||
"""
|
||||
Dataset API: Test get dataset list
|
||||
|
||||
Reference in New Issue
Block a user