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
a6a3d698
Commit
a6a3d698
authored
Mar 11, 2019
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teams: cleanup.
parent
0b209de5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
12 deletions
+4
-12
pkg/services/sqlstore/team.go
+4
-10
pkg/services/teams/team.go
+0
-2
No files found.
pkg/services/sqlstore/team.go
View file @
a6a3d698
...
...
@@ -92,10 +92,8 @@ func UpdateTeam(cmd *m.UpdateTeamCommand) error {
// DeleteTeam will delete a team, its member and any permissions connected to the team
func
DeleteTeam
(
cmd
*
m
.
DeleteTeamCommand
)
error
{
return
inTransaction
(
func
(
sess
*
DBSession
)
error
{
if
teamExists
,
err
:=
teamExists
(
cmd
.
OrgId
,
cmd
.
Id
,
sess
);
err
!=
nil
{
if
_
,
err
:=
teamExists
(
cmd
.
OrgId
,
cmd
.
Id
,
sess
);
err
!=
nil
{
return
err
}
else
if
!
teamExists
{
return
m
.
ErrTeamNotFound
}
deletes
:=
[]
string
{
...
...
@@ -118,7 +116,7 @@ func teamExists(orgId int64, teamId int64, sess *DBSession) (bool, error) {
if
res
,
err
:=
sess
.
Query
(
"SELECT 1 from team WHERE org_id=? and id=?"
,
orgId
,
teamId
);
err
!=
nil
{
return
false
,
err
}
else
if
len
(
res
)
!=
1
{
return
false
,
nil
return
false
,
m
.
ErrTeamNotFound
}
return
true
,
nil
...
...
@@ -238,10 +236,8 @@ func AddTeamMember(cmd *m.AddTeamMemberCommand) error {
return
m
.
ErrTeamMemberAlreadyAdded
}
if
teamExists
,
err
:=
teamExists
(
cmd
.
OrgId
,
cmd
.
TeamId
,
sess
);
err
!=
nil
{
if
_
,
err
:=
teamExists
(
cmd
.
OrgId
,
cmd
.
TeamId
,
sess
);
err
!=
nil
{
return
err
}
else
if
!
teamExists
{
return
m
.
ErrTeamNotFound
}
entity
:=
m
.
TeamMember
{
...
...
@@ -285,10 +281,8 @@ func UpdateTeamMember(cmd *m.UpdateTeamMemberCommand) error {
// RemoveTeamMember removes a member from a team
func
RemoveTeamMember
(
cmd
*
m
.
RemoveTeamMemberCommand
)
error
{
return
inTransaction
(
func
(
sess
*
DBSession
)
error
{
if
teamExists
,
err
:=
teamExists
(
cmd
.
OrgId
,
cmd
.
TeamId
,
sess
);
err
!=
nil
{
if
_
,
err
:=
teamExists
(
cmd
.
OrgId
,
cmd
.
TeamId
,
sess
);
err
!=
nil
{
return
err
}
else
if
!
teamExists
{
return
m
.
ErrTeamNotFound
}
var
rawSql
=
"DELETE FROM team_member WHERE org_id=? and team_id=? and user_id=?"
...
...
pkg/services/teams/team.go
View file @
a6a3d698
...
...
@@ -18,8 +18,6 @@ func CanUpdateTeam(orgId int64, teamId int64, user *m.SignedInUser) error {
OrgId
:
orgId
,
TeamId
:
teamId
,
UserId
:
user
.
UserId
,
// TODO: do we need to do something special about external users
// External: false,
}
if
err
:=
bus
.
Dispatch
(
&
cmd
);
err
!=
nil
{
...
...
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