From b5f0a5d5caa70055b030f9efe38b96bf88bccfef Mon Sep 17 00:00:00 2001 From: Sofia Papagiannaki Date: Tue, 17 Sep 2019 12:29:43 +0300 Subject: [PATCH] Api: Readonly datasources should not be created via the API (#19006) * Readonly datasources should not be created via the API * Return correct `ReadOnly` value in GetDataSourceByName --- pkg/api/datasources.go | 1 - pkg/models/datasource.go | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/api/datasources.go b/pkg/api/datasources.go index e7614614076..1fce9895e89 100644 --- a/pkg/api/datasources.go +++ b/pkg/api/datasources.go @@ -231,7 +231,6 @@ func GetDataSourceByName(c *m.ReqContext) Response { } dtos := convertModelToDtos(query.Result) - dtos.ReadOnly = true return JSON(200, &dtos) } diff --git a/pkg/models/datasource.go b/pkg/models/datasource.go index 6df4dcb3457..9c8156f2a3a 100644 --- a/pkg/models/datasource.go +++ b/pkg/models/datasource.go @@ -144,9 +144,9 @@ type AddDataSourceCommand struct { IsDefault bool `json:"isDefault"` JsonData *simplejson.Json `json:"jsonData"` SecureJsonData map[string]string `json:"secureJsonData"` - ReadOnly bool `json:"readOnly"` - OrgId int64 `json:"-"` + OrgId int64 `json:"-"` + ReadOnly bool `json:"-"` Result *DataSource } @@ -168,10 +168,10 @@ type UpdateDataSourceCommand struct { JsonData *simplejson.Json `json:"jsonData"` SecureJsonData map[string]string `json:"secureJsonData"` Version int `json:"version"` - ReadOnly bool `json:"readOnly"` - OrgId int64 `json:"-"` - Id int64 `json:"-"` + OrgId int64 `json:"-"` + Id int64 `json:"-"` + ReadOnly bool `json:"-"` Result *DataSource }