Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
744f402a
Commit
744f402a
authored
Feb 01, 2018
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db: fix failing integration tests for mysql and postgresql
parent
5171d7e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
pkg/services/sqlstore/dashboard.go
+13
-9
No files found.
pkg/services/sqlstore/dashboard.go
View file @
744f402a
...
@@ -316,16 +316,19 @@ func GetFoldersForSignedInUser(query *m.GetFoldersForSignedInUserQuery) error {
...
@@ -316,16 +316,19 @@ func GetFoldersForSignedInUser(query *m.GetFoldersForSignedInUserQuery) error {
params
=
append
(
params
,
query
.
SignedInUser
.
UserId
)
params
=
append
(
params
,
query
.
SignedInUser
.
UserId
)
params
=
append
(
params
,
query
.
OrgId
)
params
=
append
(
params
,
query
.
OrgId
)
sql
+=
`WHERE
sql
+=
`
WHERE
d.org_id = ? AND
d.org_id = ? AND
d.is_folder =
1
AND
d.is_folder =
?
AND
(
(
(d.has_acl =
1
AND da.permission > 1 AND (da.user_id = ? OR ugm.user_id = ? OR ou.id IS NOT NULL))
(d.has_acl =
?
AND da.permission > 1 AND (da.user_id = ? OR ugm.user_id = ? OR ou.id IS NOT NULL))
OR (d.has_acl =
0
AND ouRole.id IS NOT NULL)
OR (d.has_acl =
?
AND ouRole.id IS NOT NULL)
)`
)`
params
=
append
(
params
,
query
.
OrgId
)
params
=
append
(
params
,
query
.
OrgId
)
params
=
append
(
params
,
dialect
.
BooleanStr
(
true
))
params
=
append
(
params
,
dialect
.
BooleanStr
(
true
))
params
=
append
(
params
,
query
.
SignedInUser
.
UserId
)
params
=
append
(
params
,
query
.
SignedInUser
.
UserId
)
params
=
append
(
params
,
query
.
SignedInUser
.
UserId
)
params
=
append
(
params
,
query
.
SignedInUser
.
UserId
)
params
=
append
(
params
,
dialect
.
BooleanStr
(
false
))
if
len
(
query
.
Title
)
>
0
{
if
len
(
query
.
Title
)
>
0
{
sql
+=
" AND d.title "
+
dialect
.
LikeStr
()
+
" ?"
sql
+=
" AND d.title "
+
dialect
.
LikeStr
()
+
" ?"
...
@@ -333,7 +336,6 @@ func GetFoldersForSignedInUser(query *m.GetFoldersForSignedInUserQuery) error {
...
@@ -333,7 +336,6 @@ func GetFoldersForSignedInUser(query *m.GetFoldersForSignedInUserQuery) error {
}
}
sql
+=
` ORDER BY d.title ASC`
sql
+=
` ORDER BY d.title ASC`
err
=
x
.
Sql
(
sql
,
params
...
)
.
Find
(
&
query
.
Result
)
err
=
x
.
Sql
(
sql
,
params
...
)
.
Find
(
&
query
.
Result
)
}
}
...
@@ -430,9 +432,9 @@ func GetDashboardPermissionsForUser(query *m.GetDashboardPermissionsForUserQuery
...
@@ -430,9 +432,9 @@ func GetDashboardPermissionsForUser(query *m.GetDashboardPermissionsForUserQuery
params
=
append
(
params
,
query
.
OrgId
)
params
=
append
(
params
,
query
.
OrgId
)
sql
+=
`
sql
+=
`
LEFT JOIN (SELECT 1 AS permission, 'Viewer' AS
'role'
LEFT JOIN (SELECT 1 AS permission, 'Viewer' AS
role
UNION SELECT 2 AS permission, 'Editor' AS
'role'
UNION SELECT 2 AS permission, 'Editor' AS
role
UNION SELECT 4 AS permission, 'Admin' AS
'role'
) pt ON ouRole.role = pt.role
UNION SELECT 4 AS permission, 'Admin' AS
role
) pt ON ouRole.role = pt.role
WHERE
WHERE
d.Id IN (?`
+
strings
.
Repeat
(
",?"
,
len
(
query
.
DashboardIds
)
-
1
)
+
`) `
d.Id IN (?`
+
strings
.
Repeat
(
",?"
,
len
(
query
.
DashboardIds
)
-
1
)
+
`) `
for
_
,
id
:=
range
query
.
DashboardIds
{
for
_
,
id
:=
range
query
.
DashboardIds
{
...
@@ -447,13 +449,15 @@ func GetDashboardPermissionsForUser(query *m.GetDashboardPermissionsForUserQuery
...
@@ -447,13 +449,15 @@ func GetDashboardPermissionsForUser(query *m.GetDashboardPermissionsForUserQuery
)
)
group by d.id
group by d.id
order by d.id asc`
order by d.id asc`
params
=
append
(
params
,
dialect
.
BooleanStr
(
true
))
params
=
append
(
params
,
query
.
OrgId
)
params
=
append
(
params
,
query
.
OrgId
)
params
=
append
(
params
,
dialect
.
BooleanStr
(
true
))
params
=
append
(
params
,
query
.
UserId
)
params
=
append
(
params
,
query
.
UserId
)
params
=
append
(
params
,
query
.
UserId
)
params
=
append
(
params
,
query
.
UserId
)
params
=
append
(
params
,
dialect
.
BooleanStr
(
false
))
params
=
append
(
params
,
dialect
.
BooleanStr
(
false
))
x
.
ShowSQL
(
true
)
err
:=
x
.
Sql
(
sql
,
params
...
)
.
Find
(
&
query
.
Result
)
err
:=
x
.
Sql
(
sql
,
params
...
)
.
Find
(
&
query
.
Result
)
x
.
ShowSQL
(
false
)
for
_
,
p
:=
range
query
.
Result
{
for
_
,
p
:=
range
query
.
Result
{
p
.
PermissionName
=
p
.
Permission
.
String
()
p
.
PermissionName
=
p
.
Permission
.
String
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment