Merge remote-tracking branch 'origin/main' into grafana-git-ui-sync
This commit is contained in:
commit
562f4f2189
46 files changed
+746
-311
No files matched your search
@@ -20,7 +20,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
"github.com/grafana/grafana/pkg/services/datasources"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
@@ -394,11 +393,9 @@ func (hs *HTTPServer) AddDataSource(c *contextmodel.ReqContext) response.Respons
|
||||
|
||||
// It's forbidden to update the rules from the datasource api.
|
||||
// team HTTP headers update have to be done through `updateDatasourceLBACRules`
|
||||
if hs.Features != nil && hs.Features.IsEnabled(c.Req.Context(), featuremgmt.FlagTeamHttpHeaders) {
|
||||
if cmd.JsonData != nil {
|
||||
if _, ok := cmd.JsonData.CheckGet("teamHttpHeaders"); ok {
|
||||
return response.Error(http.StatusForbidden, "Cannot create datasource with team HTTP headers, need to use updateDatasourceLBACRules API", nil)
|
||||
}
|
||||
if cmd.JsonData != nil {
|
||||
if _, ok := cmd.JsonData.CheckGet("teamHttpHeaders"); ok {
|
||||
return response.Error(http.StatusForbidden, "Cannot create datasource with team HTTP headers, need to use updateDatasourceLBACRules API", nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ func TestAddDataSourceTeamHTTPHeaders(t *testing.T) {
|
||||
expectedDatasource: &datasources.DataSource{},
|
||||
},
|
||||
Cfg: setting.NewCfg(),
|
||||
Features: featuremgmt.WithFeatures(featuremgmt.FlagTeamHttpHeaders),
|
||||
Features: featuremgmt.WithFeatures(),
|
||||
accesscontrolService: actest.FakeService{},
|
||||
AccessControl: actest.FakeAccessControl{
|
||||
ExpectedEvaluate: true,
|
||||
|
||||
@@ -249,7 +249,7 @@ func TestDataSourceQueryError(t *testing.T) {
|
||||
expectedStatus: errutil.StatusInternal.HTTPStatus(),
|
||||
expectedBody: body{
|
||||
Message: "An error occurred within the plugin",
|
||||
MessageId: "plugin.downstreamError",
|
||||
MessageId: "plugin.requestFailureError",
|
||||
StatusCode: 500,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user