show admin nav link it the user only has permissions to view licensing and not other pages under admin node (#41948) (#41956)

(cherry picked from commit 03b7a55242)

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2021-11-19 14:49:25 +00:00
committed by GitHub
co-authored by Ieva
parent 984e477d00
commit 4ab201e4b5
2 changed files with 5 additions and 5 deletions
+3 -4
View File
@@ -334,12 +334,11 @@ func (hs *HTTPServer) getNavTree(c *models.ReqContext, hasEditPerm bool) ([]*dto
adminNavLinks := hs.buildAdminNavLinks(c)
if len(adminNavLinks) > 0 {
serverAdminNode := navlinks.GetServerAdminNode(adminNavLinks)
navSection := dtos.NavSectionCore
if hs.Cfg.IsNewNavigationEnabled() {
serverAdminNode.Section = dtos.NavSectionConfig
} else {
serverAdminNode.Section = dtos.NavSectionCore
navSection = dtos.NavSectionConfig
}
serverAdminNode := navlinks.GetServerAdminNode(adminNavLinks, navSection)
navTree = append(navTree, serverAdminNode)
}
+2 -1
View File
@@ -2,7 +2,7 @@ package navlinks
import "github.com/grafana/grafana/pkg/api/dtos"
func GetServerAdminNode(children []*dtos.NavLink) *dtos.NavLink {
func GetServerAdminNode(children []*dtos.NavLink, navSection string) *dtos.NavLink {
url := ""
if len(children) > 0 {
url = children[0].Url
@@ -15,6 +15,7 @@ func GetServerAdminNode(children []*dtos.NavLink) *dtos.NavLink {
Icon: "shield",
Url: url,
SortWeight: dtos.WeightAdmin,
Section: navSection,
Children: children,
}
}