Public Dashboards: Disable email-sharing when there is no license (#80887)

* PublicDashboards: Disable email-shared dashboards when feature is disabled

* fix pubdash creation when it was email-shared

* add feature name const in OSS

* update doc

* Update service.go

* fix test & linter

* fix test

* Update query_test.go

* update tests

* fix imports

* fix doc linter issues

* Update docs/sources/administration/enterprise-licensing/_index.md

* fix after merge
This commit is contained in:
Agnès Toulet
2024-02-22 09:34:14 +01:00
committed by GitHub
parent cfcf03bf7a
commit 8d68159b52
11 changed files with 174 additions and 298 deletions
@@ -26,10 +26,12 @@ import (
"github.com/grafana/grafana/pkg/services/datasources/guardian"
datasourceService "github.com/grafana/grafana/pkg/services/datasources/service"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/licensing/licensingtest"
"github.com/grafana/grafana/pkg/services/pluginsintegration/plugincontext"
pluginSettings "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings/service"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/services/publicdashboards"
publicdashboardModels "github.com/grafana/grafana/pkg/services/publicdashboards/models"
"github.com/grafana/grafana/pkg/services/query"
fakeSecrets "github.com/grafana/grafana/pkg/services/secrets/fakes"
"github.com/grafana/grafana/pkg/services/user"
@@ -73,7 +75,9 @@ func setupTestServer(
}
// build api, this will mount the routes at the same time if the feature is enabled
ProvideApi(service, rr, ac, features, &Middleware{}, cfg)
license := licensingtest.NewFakeLicensing()
license.On("FeatureEnabled", publicdashboardModels.FeaturePublicDashboardsEmailSharing).Return(false)
ProvideApi(service, rr, ac, features, &Middleware{}, cfg, license)
// connect routes to mux
rr.Register(m.Router)