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
812112f2
Commit
812112f2
authored
Jun 20, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: fix acl route
parent
aaf2a897
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
+7
-2
pkg/api/dashboard_acl.go
+2
-2
pkg/models/dashboard_acl.go
+1
-0
pkg/services/sqlstore/dashboard_acl.go
+4
-0
No files found.
pkg/api/dashboard_acl.go
View file @
812112f2
...
...
@@ -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
.
ErrDashboardPermissionUserOrUserGroupEmpty
{
if
err
==
m
.
ErrDashboardPermissionUserOrUserGroupEmpty
||
err
==
m
.
ErrDashboardPermissionDashboardEmpty
{
return
ApiError
(
409
,
err
.
Error
(),
err
)
}
return
ApiError
(
500
,
"Failed to create permission"
,
err
)
...
...
pkg/models/dashboard_acl.go
View file @
812112f2
...
...
@@ -25,6 +25,7 @@ func (p PermissionType) String() string {
// Typed errors
var
(
ErrDashboardPermissionUserOrUserGroupEmpty
=
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 @
812112f2
...
...
@@ -20,6 +20,10 @@ func SetDashboardAcl(cmd *m.SetDashboardAclCommand) error {
return
m
.
ErrDashboardPermissionUserOrUserGroupEmpty
}
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