RBAC: Remove dashboard and folder guardians (#104646)

* replace usage of folder guardians with access control evaluators

* remove NewByFolderUID guardian

* bring up to date

* fix test

* more test fixes, and don't fetch the folder before evaluating lib element access

* change what error is returned

* fix alerting test

* try to fix linter errors

* replace the use of newByFolder guardian with direct access control evaluator checks

* remove newByFolder guardian

* get rid of dashboard and folder guardians

* undo unwanted change

* undo unwanted change

* undo unwanted change

* update code owners
This commit is contained in:
Ieva
2025-05-19 09:48:16 +03:00
committed by GitHub
parent bf87c6f774
commit 2cddaf0781
18 changed files with 1 additions and 1588 deletions
@@ -23,7 +23,6 @@ import (
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/folder"
"github.com/grafana/grafana/pkg/services/folder/folderimpl"
"github.com/grafana/grafana/pkg/services/guardian"
"github.com/grafana/grafana/pkg/services/login"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/search/sort"
@@ -448,11 +447,6 @@ func TestIntegration_DashboardNestedPermissionFilter(t *testing.T) {
if db.IsTestDBSpanner() {
t.Skip("skipping integration test")
}
origNewGuardian := guardian.New
guardian.MockDashboardGuardian(&guardian.FakeDashboardGuardian{CanViewValue: true, CanSaveValue: true})
t.Cleanup(func() {
guardian.New = origNewGuardian
})
var orgID int64 = 1
@@ -563,11 +557,6 @@ func TestIntegration_DashboardNestedPermissionFilter_WithSelfContainedPermission
if db.IsTestDBSpanner() {
t.Skip("skipping integration test")
}
origNewGuardian := guardian.New
guardian.MockDashboardGuardian(&guardian.FakeDashboardGuardian{CanViewValue: true, CanSaveValue: true})
t.Cleanup(func() {
guardian.New = origNewGuardian
})
var orgID int64 = 1
@@ -680,12 +669,6 @@ func TestIntegration_DashboardNestedPermissionFilter_WithActionSets(t *testing.T
t.Skip("skipping integration test")
}
origNewGuardian := guardian.New
guardian.MockDashboardGuardian(&guardian.FakeDashboardGuardian{CanViewValue: true, CanSaveValue: true})
t.Cleanup(func() {
guardian.New = origNewGuardian
})
var orgID int64 = 1
for _, tc := range testCases {