feat(dashboard_rbac): dashboard_view access enforcement (#12875)

* test: dashboard_view_test failing

* test: tests works first time

* fix: pre-commit and  some refactoring

* fix:  after CR

* fix:  replace not_published with draft

* fix:  after CR

* fix: pre-commit fixes

* fix: pre-commit and lint fixes

* fix: remove unused

* fix: remove unused import

* fix: wrap the decorator to not block others

* chore: reuse dashboard from decorator into function
This commit is contained in:
Amit Miran
2021-02-04 20:23:53 +02:00
committed by GitHub
parent 9982fdebd8
commit b472d1841c
6 changed files with 299 additions and 114 deletions

View File

@@ -160,7 +160,7 @@ class TestDashboardDatasetSecurity(DashboardTestCase):
# arrange
admin_user = security_manager.find_user(ADMIN_USERNAME)
gamma_user = security_manager.find_user(GAMMA_USERNAME)
admin_and_not_published_dashboard = create_dashboard_to_db(
admin_and_draft_dashboard = create_dashboard_to_db(
dashboard_title="admin_owned_unpublished_dash", owners=[admin_user]
)
@@ -171,7 +171,7 @@ class TestDashboardDatasetSecurity(DashboardTestCase):
# assert
self.assertNotIn(
admin_and_not_published_dashboard.url, get_dashboards_response_as_gamma
admin_and_draft_dashboard.url, get_dashboards_response_as_gamma
)
@pytest.mark.usefixtures("load_energy_table_with_slice", "load_dashboard")