feat(invite): new user invites are now also added to correct org after sign up is completed, #2353

This commit is contained in:
Torkel Ödegaard
2015-08-11 10:45:03 +02:00
parent 74932e6311
commit 1ea0b5371a
3 changed files with 15 additions and 1 deletions
+11
View File
@@ -178,6 +178,17 @@ func CompleteInvite(c *middleware.Context, completeInvite dtos.CompleteInviteFor
Login: user.Login,
})
// add to org
addOrgUserCmd := m.AddOrgUserCommand{OrgId: invite.OrgId, UserId: user.Id, Role: invite.Role}
if err := bus.Dispatch(&addOrgUserCmd); err != nil {
return ApiError(500, "Error while trying to create org user", err)
}
// set org to active
if err := bus.Dispatch(&m.SetUsingOrgCommand{OrgId: invite.OrgId, UserId: user.Id}); err != nil {
return ApiError(500, "Failed to set org as active", err)
}
// update temp user status
updateTmpUserCmd := m.UpdateTempUserStatusCommand{Code: invite.Code, Status: m.TmpUserCompleted}
if err := bus.Dispatch(&updateTmpUserCmd); err != nil {