switch to using featureEnabled for enterprise features (#41559)

* switch to using featureEnabled for enterprise features
This commit is contained in:
Dan Cech
2022-01-07 15:11:23 -05:00
committed by GitHub
parent 9eb82f9fff
commit 34f757ba5a
34 changed files with 109 additions and 148 deletions
+1 -3
View File
@@ -250,15 +250,13 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *models.ReqContext) (map[string]i
"latestVersion": hs.updateChecker.LatestGrafanaVersion(),
"hasUpdate": hs.updateChecker.GrafanaUpdateAvailable(),
"env": setting.Env,
"isEnterprise": hs.License.HasValidLicense(),
},
"licenseInfo": map[string]interface{}{
"hasLicense": hs.License.HasLicense(),
"hasValidLicense": hs.License.HasValidLicense(),
"expiry": hs.License.Expiry(),
"stateInfo": hs.License.StateInfo(),
"licenseUrl": hs.License.LicenseURL(hasAccess(accesscontrol.ReqGrafanaAdmin, accesscontrol.LicensingPageReaderAccess)),
"edition": hs.License.Edition(),
"enabledFeatures": hs.License.EnabledFeatures(),
},
"featureToggles": hs.Cfg.FeatureToggles,
"rendererAvailable": hs.RenderService.IsAvailable(),
+1 -9
View File
@@ -611,7 +611,7 @@ func (hs *HTTPServer) setIndexViewData(c *models.ReqContext) (*dtos.IndexViewDat
NewGrafanaVersion: hs.updateChecker.LatestGrafanaVersion(),
NewGrafanaVersionExists: hs.updateChecker.GrafanaUpdateAvailable(),
AppName: setting.ApplicationName,
AppNameBodyClass: getAppNameBodyClass(hs.License.HasValidLicense()),
AppNameBodyClass: "app-grafana",
FavIcon: "public/img/fav32.png",
AppleTouchIcon: "public/img/apple-touch-icon.png",
AppTitle: "Grafana",
@@ -680,11 +680,3 @@ func (hs *HTTPServer) NotFoundHandler(c *models.ReqContext) {
c.HTML(404, "index", data)
}
func getAppNameBodyClass(validLicense bool) string {
if validLicense {
return "app-enterprise"
}
return "app-grafana"
}
+1 -1
View File
@@ -349,7 +349,7 @@ func (hs *HTTPServer) RedirectResponseWithError(ctx *models.ReqContext, err erro
}
func (hs *HTTPServer) samlEnabled() bool {
return hs.SettingsProvider.KeyValue("auth.saml", "enabled").MustBool(false) && hs.License.HasValidLicense()
return hs.SettingsProvider.KeyValue("auth.saml", "enabled").MustBool(false) && hs.License.FeatureEnabled("saml")
}
func (hs *HTTPServer) samlName() string {
+1 -1
View File
@@ -30,7 +30,7 @@ func (hs *HTTPServer) GetTeamMembers(c *models.ReqContext) response.Response {
member.AvatarUrl = dtos.GetGravatarUrl(member.Email)
member.Labels = []string{}
if hs.License.HasValidLicense() && member.External {
if hs.License.FeatureEnabled("teamgroupsync") && member.External {
authProvider := GetAuthProviderLabel(member.AuthModule)
member.Labels = append(member.Labels, authProvider)
}