mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'master' into alerting_reminder
* master: (30 commits) changelog: add notes about closing #11882 renamed variable in tests added comment, variableChange -> variableValueChange added a test added if to check if new variable has been added Gravatar fallback does not respect 'AppSubUrl'-setting (#12149) change admin password after first login changelog: adds note about closing #11958 revert: reverted singlestat panel position change PR #12004 Revert "provisioning: turn relative symlinked path into absolut paths" provisioning: turn relative symlinked path into absolut paths changelog: adds note about closing #11670 elasticsearch: sort bucket keys to fix issue wth response parser tests docs: what's new in v5.2 changelog: add notes about closing #11167 docs: docker secrets support. (#12141) alerting: show alerts for user with Viewer role datasource: added option no-direct-access to ds-http-settings diretive, closes #12138 provisioning: adds fallback if evalsymlink/abs fails tests: uses different paths depending on os ...
This commit is contained in:
@@ -116,7 +116,7 @@ func HandleAlertsQuery(query *m.GetAlertsQuery) error {
|
||||
}
|
||||
|
||||
if query.User.OrgRole != m.ROLE_ADMIN {
|
||||
builder.writeDashboardPermissionFilter(query.User, m.PERMISSION_EDIT)
|
||||
builder.writeDashboardPermissionFilter(query.User, m.PERMISSION_VIEW)
|
||||
}
|
||||
|
||||
builder.Write(" ORDER BY name ASC")
|
||||
|
||||
@@ -2,7 +2,6 @@ package sqlstore
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
@@ -110,11 +109,12 @@ func TestAlertingDataAccess(t *testing.T) {
|
||||
})
|
||||
|
||||
Convey("Viewer cannot read alerts", func() {
|
||||
alertQuery := m.GetAlertsQuery{DashboardIDs: []int64{testDash.Id}, PanelId: 1, OrgId: 1, User: &m.SignedInUser{OrgRole: m.ROLE_VIEWER}}
|
||||
viewerUser := &m.SignedInUser{OrgRole: m.ROLE_VIEWER, OrgId: 1}
|
||||
alertQuery := m.GetAlertsQuery{DashboardIDs: []int64{testDash.Id}, PanelId: 1, OrgId: 1, User: viewerUser}
|
||||
err2 := HandleAlertsQuery(&alertQuery)
|
||||
|
||||
So(err2, ShouldBeNil)
|
||||
So(alertQuery.Result, ShouldHaveLength, 0)
|
||||
So(alertQuery.Result, ShouldHaveLength, 1)
|
||||
})
|
||||
|
||||
Convey("Alerts with same dashboard id and panel id should update", func() {
|
||||
|
||||
@@ -211,4 +211,8 @@ func addDashboardMigration(mg *Migrator) {
|
||||
"name": "name",
|
||||
"external_id": "external_id",
|
||||
})
|
||||
|
||||
mg.AddMigration("Add check_sum column", NewAddColumnMigration(dashboardExtrasTableV2, &Column{
|
||||
Name: "check_sum", Type: DB_NVarchar, Length: 32, Nullable: true,
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user