mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
show notification tab only to editor (#49624)
This commit is contained in:
parent
ec65332c82
commit
307c207a24
@ -242,7 +242,7 @@ func (hs *HTTPServer) getNavTree(c *models.ReqContext, hasEditPerm bool, prefs *
|
||||
uaVisibleForOrg := hs.Cfg.UnifiedAlerting.IsEnabled() && !uaIsDisabledForOrg
|
||||
|
||||
if setting.AlertingEnabled != nil && *setting.AlertingEnabled {
|
||||
navTree = append(navTree, hs.buildLegacyAlertNavLinks()...)
|
||||
navTree = append(navTree, hs.buildLegacyAlertNavLinks(c)...)
|
||||
} else if uaVisibleForOrg {
|
||||
navTree = append(navTree, hs.buildAlertNavLinks(c)...)
|
||||
}
|
||||
@ -512,15 +512,18 @@ func (hs *HTTPServer) buildDashboardNavLinks(c *models.ReqContext, hasEditPerm b
|
||||
return dashboardChildNavs
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) buildLegacyAlertNavLinks() []*dtos.NavLink {
|
||||
func (hs *HTTPServer) buildLegacyAlertNavLinks(c *models.ReqContext) []*dtos.NavLink {
|
||||
var alertChildNavs []*dtos.NavLink
|
||||
alertChildNavs = append(alertChildNavs, &dtos.NavLink{
|
||||
Text: "Alert rules", Id: "alert-list", Url: hs.Cfg.AppSubURL + "/alerting/list", Icon: "list-ul",
|
||||
})
|
||||
alertChildNavs = append(alertChildNavs, &dtos.NavLink{
|
||||
Text: "Notification channels", Id: "channels", Url: hs.Cfg.AppSubURL + "/alerting/notifications",
|
||||
Icon: "comment-alt-share",
|
||||
})
|
||||
|
||||
if c.HasRole(models.ROLE_EDITOR) {
|
||||
alertChildNavs = append(alertChildNavs, &dtos.NavLink{
|
||||
Text: "Notification channels", Id: "channels", Url: hs.Cfg.AppSubURL + "/alerting/notifications",
|
||||
Icon: "comment-alt-share",
|
||||
})
|
||||
}
|
||||
|
||||
return []*dtos.NavLink{
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user