fix: send preferred login name on init user mail (#3105)

* fix: send preferred login name on init user

* trigger gh actions

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2022-01-24 15:22:27 +01:00
committed by GitHub
parent a824312be3
commit b64b5d89ec
3 changed files with 10 additions and 34 deletions

View File

@@ -196,12 +196,10 @@ func (u *NotifyUser) fillPreferredLoginNamesOnOrgUsers(event *es_models.Event) e
if err != nil {
return err
}
policy := new(query2.OrgIAMPolicy)
if policy == nil {
policy, err = u.getDefaultOrgIAMPolicy(context.Background())
if err != nil {
return err
}
policy, err := u.getDefaultOrgIAMPolicy(context.Background())
if err != nil {
return err
}
if !policy.UserLoginMustBeDomain {
return nil
@@ -225,12 +223,10 @@ func (u *NotifyUser) fillLoginNames(user *view_model.NotifyUser) (err error) {
if err != nil {
return err
}
policy := new(query2.OrgIAMPolicy)
if policy == nil {
policy, err = u.getDefaultOrgIAMPolicy(context.Background())
if err != nil {
return err
}
policy, err := u.getDefaultOrgIAMPolicy(context.Background())
if err != nil {
return err
}
user.SetLoginNames(policy, org.Domains)
user.PreferredLoginName = user.GenerateLoginName(org.GetPrimaryDomain().Domain, policy.UserLoginMustBeDomain)