// CheckAndSetDefaults checks and sets defaults for user invite
CheckAndSetDefaults checks and sets defaults for user invite
// CheckAndSetDefaults checks and sets defaults for user invite
func (u *UserInvite) CheckAndSetDefaults() error {
	if err := utils.CheckUserName(u.Name); err != nil {
		return trace.Wrap(err)
	}
	if u.CreatedBy == "" {
		return trace.BadParameter("missing CreatedBy")
	}
	if u.Created.IsZero() {
		u.Created = time.Now().UTC()
	}
	if len(u.Roles) == 0 {
		return trace.BadParameter("roles can't be empty")
	}
	return nil
}
func ( u * UserInvite ) CheckAndSetDefaults ( ) error { if err := utils . CheckUserName ( u . Name ) ; err != nil { return trace . Wrap ( err ) } if u . CreatedBy == " " { return trace . BadParameter ( " " ) } if u . Created . IsZero ( ) { u . Created = time . Now ( ) . UTC ( ) } if len ( u . Roles ) == 0 { return trace . BadParameter ( " " ) } return nil }
CheckAndSetDefaults checks and sets defaults for user invite
CheckAndSetDefaults checks and sets defaults for user invite