Commit 06c80340 by Torkel Ödegaard

Merge branch 'master' of github.com:grafana/grafana

parents e683f6af df3655dd
......@@ -345,8 +345,9 @@ func GetDashboards(query *m.GetDashboardsQuery) error {
func GetDashboardsByPluginId(query *m.GetDashboardsByPluginIdQuery) error {
var dashboards = make([]*m.Dashboard, 0)
whereExpr := "org_id=? AND plugin_id=? AND is_folder=" + dialect.BooleanStr(false)
err := x.Where("org_id=? AND plugin_id=? AND is_folder=0", query.OrgId, query.PluginId).Find(&dashboards)
err := x.Where(whereExpr, query.OrgId, query.PluginId).Find(&dashboards)
query.Result = dashboards
if err != nil {
......
......@@ -170,7 +170,12 @@ func GetDashboardAclInfoList(query *m.GetDashboardAclInfoListQuery) error {
FROM dashboard_acl as da,
dashboard as dash
LEFT JOIN dashboard folder on dash.folder_id = folder.id
WHERE dash.id = ? AND (dash.has_acl = 0 or folder.has_acl = 0) AND da.dashboard_id = -1
WHERE
dash.id = ? AND (
dash.has_acl = ` + dialect.BooleanStr(false) + ` or
folder.has_acl = ` + dialect.BooleanStr(false) + `
) AND
da.dashboard_id = -1
`
query.Result = make([]*m.DashboardAclInfoDTO, 0)
......
......@@ -175,14 +175,14 @@ func (sb *SearchBuilder) buildSearchWhereClause() {
}
if sb.signedInUser.OrgRole != m.ROLE_ADMIN {
allowedDashboardsSubQuery := ` AND (dashboard.has_acl = 0 OR dashboard.id in (
allowedDashboardsSubQuery := ` AND (dashboard.has_acl = ` + dialect.BooleanStr(false) + ` OR dashboard.id in (
SELECT distinct d.id AS DashboardId
FROM dashboard AS d
LEFT JOIN dashboard_acl as da on d.folder_id = da.dashboard_id or d.id = da.dashboard_id
LEFT JOIN team_member as ugm on ugm.team_id = da.team_id
LEFT JOIN org_user ou on ou.role = da.role
WHERE
d.has_acl = 1 and
d.has_acl = ` + dialect.BooleanStr(true) + ` and
(da.user_id = ? or ugm.user_id = ? or ou.id is not null)
and d.org_id = ?
)
......@@ -198,11 +198,11 @@ func (sb *SearchBuilder) buildSearchWhereClause() {
}
if sb.whereTypeFolder {
sb.sql.WriteString(" AND dashboard.is_folder = 1")
sb.sql.WriteString(" AND dashboard.is_folder = " + dialect.BooleanStr(true))
}
if sb.whereTypeDash {
sb.sql.WriteString(" AND dashboard.is_folder = 0")
sb.sql.WriteString(" AND dashboard.is_folder = " + dialect.BooleanStr(false))
}
if len(sb.whereFolderIds) > 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment