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
212a66ae
Commit
212a66ae
authored
Jun 19, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dashboard_folders' of github.com:grafana/grafana into dashboard_folders
parents
93bc588d
812112f2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
pkg/api/dashboard_acl.go
+2
-2
pkg/models/dashboard_acl.go
+2
-1
pkg/services/sqlstore/dashboard_acl.go
+4
-0
No files found.
pkg/api/dashboard_acl.go
View file @
212a66ae
...
...
@@ -27,7 +27,7 @@ func GetDashboardAclList(c *middleware.Context) Response {
}
func
PostDashboardAcl
(
c
*
middleware
.
Context
,
cmd
m
.
SetDashboardAclCommand
)
Response
{
dashId
:=
c
.
ParamsInt64
(
":
i
d"
)
dashId
:=
c
.
ParamsInt64
(
":
dashboardI
d"
)
guardian
:=
guardian
.
NewDashboardGuardian
(
dashId
,
c
.
OrgId
,
c
.
SignedInUser
)
if
canSave
,
err
:=
guardian
.
CanSave
();
err
!=
nil
||
!
canSave
{
...
...
@@ -38,7 +38,7 @@ func PostDashboardAcl(c *middleware.Context, cmd m.SetDashboardAclCommand) Respo
cmd
.
DashboardId
=
dashId
if
err
:=
bus
.
Dispatch
(
&
cmd
);
err
!=
nil
{
if
err
==
m
.
ErrDashboardAclInfoMissing
{
if
err
==
m
.
ErrDashboardAclInfoMissing
||
err
==
m
.
ErrDashboardPermissionDashboardEmpty
{
return
ApiError
(
409
,
err
.
Error
(),
err
)
}
return
ApiError
(
500
,
"Failed to create permission"
,
err
)
...
...
pkg/models/dashboard_acl.go
View file @
212a66ae
...
...
@@ -24,7 +24,8 @@ func (p PermissionType) String() string {
// Typed errors
var
(
ErrDashboardAclInfoMissing
=
errors
.
New
(
"User id and user group id cannot both be empty for a dashboard permission."
)
ErrDashboardAclInfoMissing
=
errors
.
New
(
"User id and user group id cannot both be empty for a dashboard permission."
)
ErrDashboardPermissionDashboardEmpty
=
errors
.
New
(
"Dashboard Id must be greater than zero for a dashboard permission."
)
)
// Dashboard ACL model
...
...
pkg/services/sqlstore/dashboard_acl.go
View file @
212a66ae
...
...
@@ -20,6 +20,10 @@ func SetDashboardAcl(cmd *m.SetDashboardAclCommand) error {
return
m
.
ErrDashboardAclInfoMissing
}
if
cmd
.
DashboardId
==
0
{
return
m
.
ErrDashboardPermissionDashboardEmpty
}
if
res
,
err
:=
sess
.
Query
(
"SELECT 1 from "
+
dialect
.
Quote
(
"dashboard_acl"
)
+
" WHERE dashboard_id =? and (user_group_id=? or user_id=?)"
,
cmd
.
DashboardId
,
cmd
.
UserGroupId
,
cmd
.
UserId
);
err
!=
nil
{
return
err
}
else
if
len
(
res
)
==
1
{
...
...
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