mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
show admin nav link it the user only has permissions to view licensing and not other pages under admin node (#41948)
This commit is contained in:
@@ -334,12 +334,11 @@ func (hs *HTTPServer) getNavTree(c *models.ReqContext, hasEditPerm bool) ([]*dto
|
|||||||
adminNavLinks := hs.buildAdminNavLinks(c)
|
adminNavLinks := hs.buildAdminNavLinks(c)
|
||||||
|
|
||||||
if len(adminNavLinks) > 0 {
|
if len(adminNavLinks) > 0 {
|
||||||
serverAdminNode := navlinks.GetServerAdminNode(adminNavLinks)
|
navSection := dtos.NavSectionCore
|
||||||
if hs.Cfg.IsNewNavigationEnabled() {
|
if hs.Cfg.IsNewNavigationEnabled() {
|
||||||
serverAdminNode.Section = dtos.NavSectionConfig
|
navSection = dtos.NavSectionConfig
|
||||||
} else {
|
|
||||||
serverAdminNode.Section = dtos.NavSectionCore
|
|
||||||
}
|
}
|
||||||
|
serverAdminNode := navlinks.GetServerAdminNode(adminNavLinks, navSection)
|
||||||
navTree = append(navTree, serverAdminNode)
|
navTree = append(navTree, serverAdminNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package navlinks
|
|||||||
|
|
||||||
import "github.com/grafana/grafana/pkg/api/dtos"
|
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 := ""
|
url := ""
|
||||||
if len(children) > 0 {
|
if len(children) > 0 {
|
||||||
url = children[0].Url
|
url = children[0].Url
|
||||||
@@ -15,6 +15,7 @@ func GetServerAdminNode(children []*dtos.NavLink) *dtos.NavLink {
|
|||||||
Icon: "shield",
|
Icon: "shield",
|
||||||
Url: url,
|
Url: url,
|
||||||
SortWeight: dtos.WeightAdmin,
|
SortWeight: dtos.WeightAdmin,
|
||||||
|
Section: navSection,
|
||||||
Children: children,
|
Children: children,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user