mirror of
https://github.com/grafana/grafana.git
synced 2026-08-18 17:15:08 -05:00
Public Dashboards Bug: Permissions error on panel when using mixed datasource with Enterprise (#51930)
Fixes pubdash bug for enterprise when pubdash panel uses a mixed datasource
This commit is contained in:
@@ -11,9 +11,22 @@ func GetUniqueDashboardDatasourceUids(dashboard *simplejson.Json) []string {
|
||||
for _, panelObj := range dashboard.Get("panels").MustArray() {
|
||||
panel := simplejson.NewFromAny(panelObj)
|
||||
uid := panel.Get("datasource").Get("uid").MustString()
|
||||
if _, ok := exists[uid]; !ok {
|
||||
datasourceUids = append(datasourceUids, uid)
|
||||
exists[uid] = true
|
||||
|
||||
// if uid is for a mixed datasource, get the datasource uids from the targets
|
||||
if uid == "-- Mixed --" {
|
||||
for _, target := range panel.Get("targets").MustArray() {
|
||||
target := simplejson.NewFromAny(target)
|
||||
datasourceUid := target.Get("datasource").Get("uid").MustString()
|
||||
if _, ok := exists[datasourceUid]; !ok {
|
||||
datasourceUids = append(datasourceUids, datasourceUid)
|
||||
exists[datasourceUid] = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if _, ok := exists[uid]; !ok {
|
||||
datasourceUids = append(datasourceUids, uid)
|
||||
exists[uid] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user