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
c4a18030
Commit
c4a18030
authored
Jun 19, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring more renaming
parent
e0b9ba75
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
25 additions
and
25 deletions
+25
-25
pkg/api/dashboard_acl.go
+1
-1
pkg/api/dashboard_acl_test.go
+1
-1
pkg/models/dashboard_acl.go
+1
-1
pkg/services/sqlstore/dashboard_acl.go
+2
-2
pkg/services/sqlstore/dashboard_acl_test.go
+12
-12
pkg/services/sqlstore/org_test.go
+4
-4
pkg/services/sqlstore/user_group_test.go
+2
-2
pkg/services/sqlstore/user_test.go
+2
-2
No files found.
pkg/api/dashboard_acl.go
View file @
c4a18030
...
...
@@ -18,7 +18,7 @@ func GetDashboardAcl(c *middleware.Context) Response {
return
dashboardGuardianResponse
(
err
)
}
query
:=
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
dashId
}
query
:=
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
dashId
}
if
err
:=
bus
.
Dispatch
(
&
query
);
err
!=
nil
{
return
ApiError
(
500
,
"Failed to get Dashboard ACL"
,
err
)
}
...
...
pkg/api/dashboard_acl_test.go
View file @
c4a18030
...
...
@@ -25,7 +25,7 @@ func TestDashboardAclApiEndpoint(t *testing.T) {
{
Id
:
4
,
OrgId
:
1
,
DashboardId
:
1
,
UserGroupId
:
2
,
Permissions
:
models
.
PERMISSION_READ_ONLY_EDIT
},
}
bus
.
AddHandler
(
"test"
,
func
(
query
*
models
.
GetDashboard
Permissions
Query
)
error
{
bus
.
AddHandler
(
"test"
,
func
(
query
*
models
.
GetDashboard
AclInfoList
Query
)
error
{
query
.
Result
=
dtoRes
return
nil
})
...
...
pkg/models/dashboard_acl.go
View file @
c4a18030
...
...
@@ -83,7 +83,7 @@ type RemoveDashboardAclCommand struct {
//
// QUERIES
//
type
GetDashboard
Permissions
Query
struct
{
type
GetDashboard
AclInfoList
Query
struct
{
DashboardId
int64
Result
[]
*
DashboardAclInfoDTO
}
...
...
pkg/services/sqlstore/dashboard_acl.go
View file @
c4a18030
...
...
@@ -10,7 +10,7 @@ import (
func
init
()
{
bus
.
AddHandler
(
"sql"
,
SetDashboardAcl
)
bus
.
AddHandler
(
"sql"
,
RemoveDashboardAcl
)
bus
.
AddHandler
(
"sql"
,
GetDashboard
Permissions
)
bus
.
AddHandler
(
"sql"
,
GetDashboard
AclInfoList
)
bus
.
AddHandler
(
"sql"
,
GetInheritedDashboardAcl
)
}
...
...
@@ -107,7 +107,7 @@ func GetInheritedDashboardAcl(query *m.GetInheritedDashboardAclQuery) error {
return
x
.
SQL
(
rawSQL
,
query
.
DashboardId
,
query
.
DashboardId
,
query
.
OrgId
)
.
Find
(
&
query
.
Result
)
}
func
GetDashboard
Permissions
(
query
*
m
.
GetDashboardPermissions
Query
)
error
{
func
GetDashboard
AclInfoList
(
query
*
m
.
GetDashboardAclInfoList
Query
)
error
{
rawSQL
:=
`SELECT
da.id,
da.org_id,
...
...
pkg/services/sqlstore/dashboard_acl_test.go
View file @
c4a18030
...
...
@@ -75,8 +75,8 @@ func TestDashboardAclDataAccess(t *testing.T) {
})
So
(
err
,
ShouldBeNil
)
q1
:=
&
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
Permissions
(
q1
)
q1
:=
&
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
AclInfoList
(
q1
)
So
(
err
,
ShouldBeNil
)
So
(
q1
.
Result
[
0
]
.
DashboardId
,
ShouldEqual
,
savedFolder
.
Id
)
So
(
q1
.
Result
[
0
]
.
Permissions
,
ShouldEqual
,
m
.
PERMISSION_EDIT
)
...
...
@@ -102,8 +102,8 @@ func TestDashboardAclDataAccess(t *testing.T) {
})
So
(
err
,
ShouldBeNil
)
q3
:=
&
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
Permissions
(
q3
)
q3
:=
&
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
AclInfoList
(
q3
)
So
(
err
,
ShouldBeNil
)
So
(
len
(
q3
.
Result
),
ShouldEqual
,
1
)
So
(
q3
.
Result
[
0
]
.
DashboardId
,
ShouldEqual
,
savedFolder
.
Id
)
...
...
@@ -120,8 +120,8 @@ func TestDashboardAclDataAccess(t *testing.T) {
})
So
(
err
,
ShouldBeNil
)
q3
:=
&
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
Permissions
(
q3
)
q3
:=
&
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
AclInfoList
(
q3
)
So
(
err
,
ShouldBeNil
)
So
(
len
(
q3
.
Result
),
ShouldEqual
,
0
)
})
...
...
@@ -141,8 +141,8 @@ func TestDashboardAclDataAccess(t *testing.T) {
})
So
(
err
,
ShouldBeNil
)
q1
:=
&
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
Permissions
(
q1
)
q1
:=
&
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
AclInfoList
(
q1
)
So
(
err
,
ShouldBeNil
)
So
(
q1
.
Result
[
0
]
.
DashboardId
,
ShouldEqual
,
savedFolder
.
Id
)
So
(
q1
.
Result
[
0
]
.
Permissions
,
ShouldEqual
,
m
.
PERMISSION_EDIT
)
...
...
@@ -158,8 +158,8 @@ func TestDashboardAclDataAccess(t *testing.T) {
})
So
(
err
,
ShouldBeNil
)
q3
:=
&
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
Permissions
(
q3
)
q3
:=
&
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
AclInfoList
(
q3
)
So
(
err
,
ShouldBeNil
)
So
(
len
(
q3
.
Result
),
ShouldEqual
,
1
)
So
(
q3
.
Result
[
0
]
.
DashboardId
,
ShouldEqual
,
savedFolder
.
Id
)
...
...
@@ -176,8 +176,8 @@ func TestDashboardAclDataAccess(t *testing.T) {
})
So
(
err
,
ShouldBeNil
)
q3
:=
&
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
Permissions
(
q3
)
q3
:=
&
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
savedFolder
.
Id
}
err
=
GetDashboard
AclInfoList
(
q3
)
So
(
err
,
ShouldBeNil
)
So
(
len
(
q3
.
Result
),
ShouldEqual
,
0
)
})
...
...
pkg/services/sqlstore/org_test.go
View file @
c4a18030
...
...
@@ -186,16 +186,16 @@ func TestAccountDataAccess(t *testing.T) {
So
(
err
,
ShouldBeNil
)
Convey
(
"Should remove dependent permissions for deleted org user"
,
func
()
{
permQuery
:=
&
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
1
}
err
=
GetDashboard
Permissions
(
permQuery
)
permQuery
:=
&
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
1
}
err
=
GetDashboard
AclInfoList
(
permQuery
)
So
(
err
,
ShouldBeNil
)
So
(
len
(
permQuery
.
Result
),
ShouldEqual
,
0
)
})
Convey
(
"Should not remove dashboard permissions for same user in another org"
,
func
()
{
permQuery
:=
&
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
2
}
err
=
GetDashboard
Permissions
(
permQuery
)
permQuery
:=
&
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
2
}
err
=
GetDashboard
AclInfoList
(
permQuery
)
So
(
err
,
ShouldBeNil
)
So
(
permQuery
.
Result
[
0
]
.
OrgId
,
ShouldEqual
,
ac3
.
OrgId
)
...
...
pkg/services/sqlstore/user_group_test.go
View file @
c4a18030
...
...
@@ -103,8 +103,8 @@ func TestUserGroupCommandsAndQueries(t *testing.T) {
err
=
GetUserGroupById
(
query
)
So
(
err
,
ShouldEqual
,
m
.
ErrUserGroupNotFound
)
permQuery
:=
&
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
1
}
err
=
GetDashboard
Permissions
(
permQuery
)
permQuery
:=
&
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
1
}
err
=
GetDashboard
AclInfoList
(
permQuery
)
So
(
err
,
ShouldBeNil
)
So
(
len
(
permQuery
.
Result
),
ShouldEqual
,
0
)
...
...
pkg/services/sqlstore/user_test.go
View file @
c4a18030
...
...
@@ -116,8 +116,8 @@ func TestUserDataAccess(t *testing.T) {
So
(
len
(
query
.
Result
),
ShouldEqual
,
1
)
permQuery
:=
&
m
.
GetDashboard
Permissions
Query
{
DashboardId
:
1
}
err
=
GetDashboard
Permissions
(
permQuery
)
permQuery
:=
&
m
.
GetDashboard
AclInfoList
Query
{
DashboardId
:
1
}
err
=
GetDashboard
AclInfoList
(
permQuery
)
So
(
err
,
ShouldBeNil
)
So
(
len
(
permQuery
.
Result
),
ShouldEqual
,
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