mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Navigation: Fix Home logo always going to /login (#62658)
* only redirect to /login when anonymous access is disabled * only search for dashboards when not logged in if anon access is enabled * fix go logic * add unit tests
This commit is contained in:
@@ -181,6 +181,7 @@ type FrontendSettingsDTO struct {
|
||||
LicenseInfo FrontendSettingsLicenseInfoDTO `json:"licenseInfo"`
|
||||
|
||||
FeatureToggles map[string]bool `json:"featureToggles"`
|
||||
AnonymousEnabled bool `json:"anonymousEnabled"`
|
||||
RendererAvailable bool `json:"rendererAvailable"`
|
||||
RendererVersion string `json:"rendererVersion"`
|
||||
SecretsManagerPluginEnabled bool `json:"secretsManagerPluginEnabled"`
|
||||
|
||||
@@ -174,6 +174,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
|
||||
},
|
||||
|
||||
FeatureToggles: hs.Features.GetEnabled(c.Req.Context()),
|
||||
AnonymousEnabled: hs.Cfg.AnonymousEnabled,
|
||||
RendererAvailable: hs.RenderService.IsAvailable(c.Req.Context()),
|
||||
RendererVersion: hs.RenderService.Version(),
|
||||
SecretsManagerPluginEnabled: secretsManagerPluginEnabled,
|
||||
|
||||
@@ -214,10 +214,14 @@ func (s *ServiceImpl) GetNavTree(c *contextmodel.ReqContext, hasEditPerm bool, p
|
||||
|
||||
func (s *ServiceImpl) getHomeNode(c *contextmodel.ReqContext, prefs *pref.Preference) *navtree.NavLink {
|
||||
homeUrl := s.cfg.AppSubURL + "/"
|
||||
homePage := s.cfg.HomePage
|
||||
if !c.IsSignedIn && !s.cfg.AnonymousEnabled {
|
||||
homeUrl = s.cfg.AppSubURL + "/login"
|
||||
} else {
|
||||
homePage := s.cfg.HomePage
|
||||
|
||||
if prefs.HomeDashboardID == 0 && len(homePage) > 0 {
|
||||
homeUrl = homePage
|
||||
if prefs.HomeDashboardID == 0 && len(homePage) > 0 {
|
||||
homeUrl = homePage
|
||||
}
|
||||
}
|
||||
|
||||
homeNode := &navtree.NavLink{
|
||||
|
||||
Reference in New Issue
Block a user