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
9f33f003
Commit
9f33f003
authored
Mar 14, 2019
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teams: refactor.
parent
9f8e4391
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
pkg/services/sqlstore/team.go
+15
-6
No files found.
pkg/services/sqlstore/team.go
View file @
9f33f003
...
...
@@ -255,18 +255,27 @@ func AddTeamMember(cmd *m.AddTeamMemberCommand) error {
})
}
// UpdateTeamMember updates a team member
func
UpdateTeamMember
(
cmd
*
m
.
UpdateTeamMemberCommand
)
error
{
return
inTransaction
(
func
(
sess
*
DBSession
)
error
{
func
getTeamMember
(
sess
*
DBSession
,
orgId
int64
,
teamId
int64
,
userId
int64
)
(
m
.
TeamMember
,
error
)
{
rawSql
:=
`SELECT * FROM team_member WHERE org_id=? and team_id=? and user_id=?`
var
member
m
.
TeamMember
exists
,
err
:=
sess
.
SQL
(
rawSql
,
cmd
.
OrgId
,
cmd
.
TeamId
,
cmd
.
U
serId
)
.
Get
(
&
member
)
exists
,
err
:=
sess
.
SQL
(
rawSql
,
orgId
,
teamId
,
u
serId
)
.
Get
(
&
member
)
if
err
!=
nil
{
return
err
return
member
,
err
}
if
!
exists
{
return
m
.
ErrTeamMemberNotFound
return
member
,
m
.
ErrTeamMemberNotFound
}
return
member
,
nil
}
// UpdateTeamMember updates a team member
func
UpdateTeamMember
(
cmd
*
m
.
UpdateTeamMemberCommand
)
error
{
return
inTransaction
(
func
(
sess
*
DBSession
)
error
{
member
,
err
:=
getTeamMember
(
sess
,
cmd
.
OrgId
,
cmd
.
TeamId
,
cmd
.
UserId
)
if
err
!=
nil
{
return
err
}
if
cmd
.
ProtectLastAdmin
{
...
...
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