2016-09-29 02:44:05 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2017-03-15 15:55:30 +00:00
|
|
|
"context"
|
|
|
|
|
2021-06-26 04:46:51 +00:00
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
2016-09-29 02:44:05 +00:00
|
|
|
)
|
|
|
|
|
2021-06-06 22:07:29 +00:00
|
|
|
func (mw validationMiddleware) InviteNewUser(ctx context.Context, payload fleet.InvitePayload) (*fleet.Invite, error) {
|
|
|
|
invalid := &fleet.InvalidArgumentError{}
|
2016-09-29 02:44:05 +00:00
|
|
|
if payload.Email == nil {
|
|
|
|
invalid.Append("email", "missing required argument")
|
|
|
|
}
|
|
|
|
if invalid.HasErrors() {
|
|
|
|
return nil, invalid
|
|
|
|
}
|
|
|
|
return mw.Service.InviteNewUser(ctx, payload)
|
|
|
|
}
|