teams: editor/viewer team admin cant remove the last admin.

This commit is contained in:
Leonard Gram
2019-03-19 14:01:14 +01:00
parent 246e128048
commit c420af16b1
4 changed files with 33 additions and 6 deletions
+5 -1
View File
@@ -67,6 +67,10 @@ func UpdateTeamMember(c *m.ReqContext, cmd m.UpdateTeamMemberCommand) Response {
return Error(403, "Not allowed to update team member", err)
}
if c.OrgRole != m.ROLE_ADMIN {
cmd.ProtectLastAdmin = true
}
cmd.TeamId = teamId
cmd.UserId = c.ParamsInt64(":userId")
cmd.OrgId = orgId
@@ -91,7 +95,7 @@ func (hs *HTTPServer) RemoveTeamMember(c *m.ReqContext) Response {
}
protectLastAdmin := false
if c.OrgRole == m.ROLE_EDITOR {
if c.OrgRole != m.ROLE_ADMIN {
protectLastAdmin = true
}