teams: cleanup.

This commit is contained in:
Leonard Gram 2019-03-13 16:46:35 +01:00
parent ccfd6789ca
commit 3f57a81c47

View File

@ -31,16 +31,13 @@ func GetTeamMembers(c *m.ReqContext) Response {
// POST /api/teams/:teamId/members
func AddTeamMember(c *m.ReqContext, cmd m.AddTeamMemberCommand) Response {
teamId := c.ParamsInt64(":teamId")
orgId := c.OrgId
cmd.OrgId = c.OrgId
cmd.TeamId = c.ParamsInt64(":teamId")
if err := teamguardian.CanAdmin(orgId, teamId, c.SignedInUser); err != nil {
if err := teamguardian.CanAdmin(cmd.OrgId, cmd.TeamId, c.SignedInUser); err != nil {
return Error(403, "Not allowed to add team member", err)
}
cmd.TeamId = teamId
cmd.OrgId = orgId
if err := bus.Dispatch(&cmd); err != nil {
if err == m.ErrTeamNotFound {
return Error(404, "Team not found", nil)