chore(console): remove first and lastName fallback from user (#5629)

* chore(console): remove first and lastName fallback from user

* use display name and ensure it's set without required name fields

* add user type to user grant and memberships responses

* contributor, members

* fix avatar display checks

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
Max Peintner
2023-04-11 17:56:51 +02:00
committed by GitHub
parent 8bf36301ed
commit 1c1d66cbe8
37 changed files with 218 additions and 114 deletions

View File

@@ -1,6 +1,7 @@
package domain
import (
"strings"
"time"
"github.com/zitadel/zitadel/internal/crypto"
@@ -89,10 +90,16 @@ func (u *Human) CheckDomainPolicy(policy *DomainPolicy) error {
return nil
}
func (u *Human) SetNamesAsDisplayname() {
func (u *Human) EnsureDisplayName() {
if u.Profile != nil && u.DisplayName == "" && u.FirstName != "" && u.LastName != "" {
u.DisplayName = u.FirstName + " " + u.LastName
return
}
if u.Email != nil && strings.TrimSpace(string(u.Email.EmailAddress)) != "" {
u.DisplayName = string(u.Email.EmailAddress)
return
}
u.DisplayName = u.Username
}
func (u *Human) HashPasswordIfExisting(policy *PasswordComplexityPolicy, passwordAlg crypto.HashAlgorithm, onetime bool) error {