mirror of
https://github.com/grafana/grafana.git
synced 2024-11-24 09:50:29 -06:00
teams: cleanup.
This commit is contained in:
parent
ccfd6789ca
commit
3f57a81c47
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user