mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix: Alpha should not be able to edit datasets that they don't own (#19854)
* fix api for checking owners
* fix styles for disabling
* fix styles for disabling
* fix lint
* fix lint
* add owners key
* plzz
* remove
* update test
* add tooltip
* add type
* fix test
* fix user reference
* lit
* fix test
* work
(cherry picked from commit 8b15b68979)
This commit is contained in:
committed by
Michael S. Molina
parent
94d4179045
commit
2bd89d1705
@@ -278,6 +278,7 @@ class TestDatasource(SupersetTestCase):
|
||||
|
||||
datasource_post = get_datasource_post()
|
||||
datasource_post["id"] = tbl_id
|
||||
datasource_post["owners"] = [1]
|
||||
data = dict(data=json.dumps(datasource_post))
|
||||
resp = self.get_json_resp("/datasource/save/", data)
|
||||
for k in datasource_post:
|
||||
@@ -299,11 +300,14 @@ class TestDatasource(SupersetTestCase):
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
def test_change_database(self):
|
||||
self.login(username="admin")
|
||||
admin_user = self.get_user("admin")
|
||||
|
||||
tbl = self.get_table(name="birth_names")
|
||||
tbl_id = tbl.id
|
||||
db_id = tbl.database_id
|
||||
datasource_post = get_datasource_post()
|
||||
datasource_post["id"] = tbl_id
|
||||
datasource_post["owners"] = [admin_user.id]
|
||||
|
||||
new_db = self.create_fake_db()
|
||||
datasource_post["database"]["id"] = new_db.id
|
||||
@@ -318,10 +322,12 @@ class TestDatasource(SupersetTestCase):
|
||||
|
||||
def test_save_duplicate_key(self):
|
||||
self.login(username="admin")
|
||||
admin_user = self.get_user("admin")
|
||||
tbl_id = self.get_table(name="birth_names").id
|
||||
|
||||
datasource_post = get_datasource_post()
|
||||
datasource_post["id"] = tbl_id
|
||||
datasource_post["owners"] = [admin_user.id]
|
||||
datasource_post["columns"].extend(
|
||||
[
|
||||
{
|
||||
@@ -346,10 +352,12 @@ class TestDatasource(SupersetTestCase):
|
||||
|
||||
def test_get_datasource(self):
|
||||
self.login(username="admin")
|
||||
admin_user = self.get_user("admin")
|
||||
tbl = self.get_table(name="birth_names")
|
||||
|
||||
datasource_post = get_datasource_post()
|
||||
datasource_post["id"] = tbl.id
|
||||
datasource_post["owners"] = [admin_user.id]
|
||||
data = dict(data=json.dumps(datasource_post))
|
||||
self.get_json_resp("/datasource/save/", data)
|
||||
url = f"/datasource/get/{tbl.type}/{tbl.id}/"
|
||||
|
||||
Reference in New Issue
Block a user