fleet/server/fleet/invites.go
Ian Littman 2ef729e473
Allow opting in users to email verification on login (#24273)
#22790 

Changes file is on the FE PR.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated tests
- [x] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [x] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [x] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [x] Manual QA for all new/changed functionality
2024-12-05 08:37:10 -06:00

35 lines
1.1 KiB
Go

package fleet
import (
"gopkg.in/guregu/null.v3"
)
// InvitePayload contains fields required to create a new user invite or update an existing one.
type InvitePayload struct {
Email *string `json:"email"`
Name *string `json:"name"`
Position *string `json:"position"`
SSOEnabled *bool `json:"sso_enabled"`
MFAEnabled *bool `json:"mfa_enabled"`
GlobalRole null.String `json:"global_role"`
Teams []UserTeam `json:"teams"`
}
// Invite represents an invitation for a user to join Fleet.
type Invite struct {
UpdateCreateTimestamps
ID uint `json:"id"`
InvitedBy uint `json:"invited_by" db:"invited_by"`
Email string `json:"email" db:"email"`
Name string `json:"name" db:"name"`
Position string `json:"position,omitempty"`
Token string `json:"-"`
SSOEnabled bool `json:"sso_enabled" db:"sso_enabled"`
MFAEnabled bool `json:"mfa_enabled" db:"mfa_enabled"`
GlobalRole null.String `json:"global_role" db:"global_role"`
Teams []UserTeam `json:"teams"`
}
func (i Invite) AuthzType() string {
return "invite"
}