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
e2900158
Commit
e2900158
authored
Jun 19, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring: renaming
parent
aaf2a897
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
pkg/api/dashboard_acl.go
+1
-1
pkg/models/dashboard_acl.go
+9
-9
pkg/services/sqlstore/dashboard_acl.go
+1
-1
pkg/services/sqlstore/dashboard_acl_test.go
+1
-1
No files found.
pkg/api/dashboard_acl.go
View file @
e2900158
...
...
@@ -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
.
ErrDashboard
PermissionUserOrUserGroupEmpty
{
if
err
==
m
.
ErrDashboard
AclInfoMissing
{
return
ApiError
(
409
,
err
.
Error
(),
err
)
}
return
ApiError
(
500
,
"Failed to create permission"
,
err
)
...
...
pkg/models/dashboard_acl.go
View file @
e2900158
...
...
@@ -24,21 +24,21 @@ func (p PermissionType) String() string {
// Typed errors
var
(
ErrDashboard
PermissionUserOrUserGroupEmpty
=
errors
.
New
(
"User id and user group id cannot both be empty for a dashboard permission."
)
ErrDashboard
AclInfoMissing
=
errors
.
New
(
"User id and user group id cannot both be empty for a dashboard permission."
)
)
// Dashboard ACL model
type
DashboardAcl
struct
{
Id
int64
`json:"id"`
OrgId
int64
`json:"-"`
DashboardId
int64
`json:"dashboardId"`
Id
int64
OrgId
int64
DashboardId
int64
Created
time
.
Time
`json:"created"`
Updated
time
.
Time
`json:"updated"`
UserId
int64
UserGroupId
int64
Permissions
PermissionType
UserId
int64
`json:"userId"`
UserGroupId
int64
`json:"userGroupId"`
Permissions
PermissionType
`json:"permissions"`
Created
time
.
Time
Updated
time
.
Time
}
type
DashboardAclInfoDTO
struct
{
...
...
pkg/services/sqlstore/dashboard_acl.go
View file @
e2900158
...
...
@@ -17,7 +17,7 @@ func init() {
func
SetDashboardAcl
(
cmd
*
m
.
SetDashboardAclCommand
)
error
{
return
inTransaction
(
func
(
sess
*
DBSession
)
error
{
if
cmd
.
UserId
==
0
&&
cmd
.
UserGroupId
==
0
{
return
m
.
ErrDashboard
PermissionUserOrUserGroupEmpty
return
m
.
ErrDashboard
AclInfoMissing
}
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
{
...
...
pkg/services/sqlstore/dashboard_acl_test.go
View file @
e2900158
...
...
@@ -22,7 +22,7 @@ func TestDashboardAclDataAccess(t *testing.T) {
DashboardId
:
savedFolder
.
Id
,
Permissions
:
m
.
PERMISSION_EDIT
,
})
So
(
err
,
ShouldEqual
,
m
.
ErrDashboard
PermissionUserOrUserGroupEmpty
)
So
(
err
,
ShouldEqual
,
m
.
ErrDashboard
AclInfoMissing
)
})
Convey
(
"Given dashboard folder permission"
,
func
()
{
...
...
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