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
06c80340
Commit
06c80340
authored
Dec 20, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:grafana/grafana
parents
e683f6af
df3655dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
pkg/services/sqlstore/dashboard.go
+2
-1
pkg/services/sqlstore/dashboard_acl.go
+6
-1
pkg/services/sqlstore/search_builder.go
+4
-4
No files found.
pkg/services/sqlstore/dashboard.go
View file @
06c80340
...
@@ -345,8 +345,9 @@ func GetDashboards(query *m.GetDashboardsQuery) error {
...
@@ -345,8 +345,9 @@ func GetDashboards(query *m.GetDashboardsQuery) error {
func
GetDashboardsByPluginId
(
query
*
m
.
GetDashboardsByPluginIdQuery
)
error
{
func
GetDashboardsByPluginId
(
query
*
m
.
GetDashboardsByPluginIdQuery
)
error
{
var
dashboards
=
make
([]
*
m
.
Dashboard
,
0
)
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
query
.
Result
=
dashboards
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/services/sqlstore/dashboard_acl.go
View file @
06c80340
...
@@ -170,7 +170,12 @@ func GetDashboardAclInfoList(query *m.GetDashboardAclInfoListQuery) error {
...
@@ -170,7 +170,12 @@ func GetDashboardAclInfoList(query *m.GetDashboardAclInfoListQuery) error {
FROM dashboard_acl as da,
FROM dashboard_acl as da,
dashboard as dash
dashboard as dash
LEFT JOIN dashboard folder on dash.folder_id = folder.id
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
)
query
.
Result
=
make
([]
*
m
.
DashboardAclInfoDTO
,
0
)
...
...
pkg/services/sqlstore/search_builder.go
View file @
06c80340
...
@@ -175,14 +175,14 @@ func (sb *SearchBuilder) buildSearchWhereClause() {
...
@@ -175,14 +175,14 @@ func (sb *SearchBuilder) buildSearchWhereClause() {
}
}
if
sb
.
signedInUser
.
OrgRole
!=
m
.
ROLE_ADMIN
{
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
SELECT distinct d.id AS DashboardId
FROM dashboard AS d
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 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 team_member as ugm on ugm.team_id = da.team_id
LEFT JOIN org_user ou on ou.role = da.role
LEFT JOIN org_user ou on ou.role = da.role
WHERE
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)
(da.user_id = ? or ugm.user_id = ? or ou.id is not null)
and d.org_id = ?
and d.org_id = ?
)
)
...
@@ -198,11 +198,11 @@ func (sb *SearchBuilder) buildSearchWhereClause() {
...
@@ -198,11 +198,11 @@ func (sb *SearchBuilder) buildSearchWhereClause() {
}
}
if
sb
.
whereTypeFolder
{
if
sb
.
whereTypeFolder
{
sb
.
sql
.
WriteString
(
" AND dashboard.is_folder =
1"
)
sb
.
sql
.
WriteString
(
" AND dashboard.is_folder =
"
+
dialect
.
BooleanStr
(
true
)
)
}
}
if
sb
.
whereTypeDash
{
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
{
if
len
(
sb
.
whereFolderIds
)
>
0
{
...
...
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