2019-11-29 06:59:40 -05:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
|
// See LICENSE.txt for license information.
|
2017-04-10 08:19:49 -04:00
|
|
|
|
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
type SwitchRequest struct {
|
|
|
|
|
CurrentService string `json:"current_service"`
|
|
|
|
|
NewService string `json:"new_service"`
|
|
|
|
|
Email string `json:"email"`
|
2017-06-15 10:34:20 -04:00
|
|
|
Password string `json:"password"`
|
2017-04-10 08:19:49 -04:00
|
|
|
NewPassword string `json:"new_password"`
|
|
|
|
|
MfaCode string `json:"mfa_code"`
|
2018-05-10 12:46:09 -04:00
|
|
|
LdapLoginId string `json:"ldap_id"`
|
2017-04-10 08:19:49 -04:00
|
|
|
}
|
|
|
|
|
|
2025-03-31 04:44:34 -04:00
|
|
|
func (o *SwitchRequest) Auditable() map[string]any {
|
|
|
|
|
return map[string]any{
|
2023-03-16 12:50:00 -04:00
|
|
|
"current_service": o.CurrentService,
|
|
|
|
|
"new_service": o.NewService,
|
|
|
|
|
"email": o.Email,
|
|
|
|
|
"ldap_login_id": o.LdapLoginId,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-10 08:19:49 -04:00
|
|
|
func (o *SwitchRequest) EmailToOAuth() bool {
|
2021-07-12 14:05:36 -04:00
|
|
|
return o.CurrentService == UserAuthServiceEmail &&
|
|
|
|
|
(o.NewService == UserAuthServiceSaml ||
|
|
|
|
|
o.NewService == UserAuthServiceGitlab ||
|
|
|
|
|
o.NewService == ServiceGoogle ||
|
|
|
|
|
o.NewService == ServiceOffice365 ||
|
|
|
|
|
o.NewService == ServiceOpenid)
|
2017-04-10 08:19:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (o *SwitchRequest) OAuthToEmail() bool {
|
2021-07-12 14:05:36 -04:00
|
|
|
return (o.CurrentService == UserAuthServiceSaml ||
|
|
|
|
|
o.CurrentService == UserAuthServiceGitlab ||
|
|
|
|
|
o.CurrentService == ServiceGoogle ||
|
|
|
|
|
o.CurrentService == ServiceOffice365 ||
|
|
|
|
|
o.CurrentService == ServiceOpenid) && o.NewService == UserAuthServiceEmail
|
2017-04-10 08:19:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (o *SwitchRequest) EmailToLdap() bool {
|
2021-07-12 14:05:36 -04:00
|
|
|
return o.CurrentService == UserAuthServiceEmail && o.NewService == UserAuthServiceLdap
|
2017-04-10 08:19:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (o *SwitchRequest) LdapToEmail() bool {
|
2021-07-12 14:05:36 -04:00
|
|
|
return o.CurrentService == UserAuthServiceLdap && o.NewService == UserAuthServiceEmail
|
2017-04-10 08:19:49 -04:00
|
|
|
}
|