RBAC: add folder UID scope resolver (#62695)

* add folder uid scope resolver

* undo guardian change, move it to a separate PR

* fix test + linting
This commit is contained in:
Ieva
2023-02-07 16:27:20 +00:00
committed by GitHub
parent 1cfd3f81fb
commit 078639abcd
3 changed files with 29 additions and 6 deletions

View File

@ -48,7 +48,7 @@ func ProvideService(
features featuremgmt.FeatureToggles,
) folder.Service {
store := ProvideStore(db, cfg, features)
svr := &Service{
srv := &Service{
cfg: cfg,
log: log.New("folder-service"),
dashboardStore: dashboardStore,
@ -59,12 +59,13 @@ func ProvideService(
bus: bus,
}
if features.IsEnabled(featuremgmt.FlagNestedFolders) {
svr.DBMigration(db)
srv.DBMigration(db)
}
ac.RegisterScopeAttributeResolver(dashboards.NewFolderNameScopeResolver(dashboardStore, folderStore, svr))
ac.RegisterScopeAttributeResolver(dashboards.NewFolderIDScopeResolver(dashboardStore, folderStore, svr))
return svr
ac.RegisterScopeAttributeResolver(dashboards.NewFolderNameScopeResolver(dashboardStore, folderStore, srv))
ac.RegisterScopeAttributeResolver(dashboards.NewFolderIDScopeResolver(dashboardStore, folderStore, srv))
ac.RegisterScopeAttributeResolver(dashboards.NewFolderUIDScopeResolver(dashboardStore, folderStore, srv))
return srv
}
func (s *Service) DBMigration(db db.DB) {