NavTree: Don't add license and stats page unless your a Grafana Admin (#56410)

This commit is contained in:
Torkel Ödegaard
2022-10-06 14:30:51 +02:00
committed by GitHub
parent 3a76c7aac3
commit 9300ae7ce6

View File

@@ -55,6 +55,10 @@ func ProvideService(cfg *setting.Cfg, hooksService *hooks.HooksService) *OSSLice
HooksService: hooksService,
}
l.HooksService.AddIndexDataHook(func(indexData *dtos.IndexViewData, req *models.ReqContext) {
if !req.IsGrafanaAdmin {
return
}
if adminNode := indexData.NavTree.FindById(navtree.NavIDAdmin); adminNode != nil {
adminNode.Children = append(adminNode.Children, &navtree.NavLink{
Text: "Stats and license",