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
222a938c
Commit
222a938c
authored
Jun 14, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: delete dependent permissions on user group delete
parent
210813f1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
+9
-1
pkg/services/sqlstore/user_group.go
+1
-0
pkg/services/sqlstore/user_group_test.go
+8
-1
No files found.
pkg/services/sqlstore/user_group.go
View file @
222a938c
...
...
@@ -84,6 +84,7 @@ func DeleteUserGroup(cmd *m.DeleteUserGroupCommand) error {
deletes
:=
[]
string
{
"DELETE FROM user_group_member WHERE user_group_id = ?"
,
"DELETE FROM user_group WHERE id = ?"
,
"DELETE FROM dashboard_acl WHERE user_group_id = ?"
,
}
for
_
,
sql
:=
range
deletes
{
...
...
pkg/services/sqlstore/user_group_test.go
View file @
222a938c
...
...
@@ -88,12 +88,13 @@ func TestUserGroupCommandsAndQueries(t *testing.T) {
So
(
len
(
q1
.
Result
),
ShouldEqual
,
0
)
})
Convey
(
"Should be able to remove a group with users"
,
func
()
{
Convey
(
"Should be able to remove a group with users
and permissions
"
,
func
()
{
groupId
:=
group2
.
Result
.
Id
err
:=
AddUserGroupMember
(
&
m
.
AddUserGroupMemberCommand
{
OrgId
:
1
,
UserGroupId
:
groupId
,
UserId
:
userIds
[
1
]})
So
(
err
,
ShouldBeNil
)
err
=
AddUserGroupMember
(
&
m
.
AddUserGroupMemberCommand
{
OrgId
:
1
,
UserGroupId
:
groupId
,
UserId
:
userIds
[
2
]})
So
(
err
,
ShouldBeNil
)
err
=
AddOrUpdateDashboardPermission
(
&
m
.
AddOrUpdateDashboardPermissionCommand
{
DashboardId
:
1
,
OrgId
:
1
,
PermissionType
:
m
.
PERMISSION_EDIT
,
UserGroupId
:
groupId
})
err
=
DeleteUserGroup
(
&
m
.
DeleteUserGroupCommand
{
Id
:
groupId
})
So
(
err
,
ShouldBeNil
)
...
...
@@ -101,6 +102,12 @@ func TestUserGroupCommandsAndQueries(t *testing.T) {
query
:=
&
m
.
GetUserGroupByIdQuery
{
Id
:
groupId
}
err
=
GetUserGroupById
(
query
)
So
(
err
,
ShouldEqual
,
m
.
ErrUserGroupNotFound
)
permQuery
:=
&
m
.
GetDashboardPermissionsQuery
{
DashboardId
:
1
}
err
=
GetDashboardPermissions
(
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