mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Fix saving of teams in invitations (#632)
This commit is contained in:
parent
cdf43a79bd
commit
db11f7b6aa
3 changed files with 3 additions and 1 deletions
|
|
@ -31,6 +31,7 @@ func (d *Datastore) NewInvite(i *kolide.Invite) (*kolide.Invite, error) {
|
||||||
i.ID = uint(id)
|
i.ID = uint(id)
|
||||||
|
|
||||||
if len(i.Teams) == 0 {
|
if len(i.Teams) == 0 {
|
||||||
|
i.Teams = []kolide.UserTeam{}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ type InvitePayload struct {
|
||||||
Position *string
|
Position *string
|
||||||
SSOEnabled *bool `json:"sso_enabled"`
|
SSOEnabled *bool `json:"sso_enabled"`
|
||||||
GlobalRole null.String `json:"global_role"`
|
GlobalRole null.String `json:"global_role"`
|
||||||
Teams []UserTeam `json:"teams,omitempty"`
|
Teams []UserTeam `json:"teams"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invite represents an invitation for a user to join Fleet.
|
// Invite represents an invitation for a user to join Fleet.
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ func (svc service) InviteNewUser(ctx context.Context, payload kolide.InvitePaylo
|
||||||
InvitedBy: inviter.ID,
|
InvitedBy: inviter.ID,
|
||||||
Token: token,
|
Token: token,
|
||||||
GlobalRole: payload.GlobalRole,
|
GlobalRole: payload.GlobalRole,
|
||||||
|
Teams: payload.Teams,
|
||||||
}
|
}
|
||||||
if payload.Position != nil {
|
if payload.Position != nil {
|
||||||
invite.Position = *payload.Position
|
invite.Position = *payload.Position
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue