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

@@ -9,6 +9,7 @@ import (
"testing"
"github.com/zitadel/zitadel/internal/database"
"github.com/zitadel/zitadel/internal/domain"
)
var (
@@ -26,6 +27,7 @@ var (
", projections.users8_humans.display_name" +
", projections.users8_machines.name" +
", projections.users8_humans.avatar_key" +
", projections.users8.type" +
", COUNT(*) OVER () " +
"FROM projections.org_members3 AS members " +
"LEFT JOIN projections.users8_humans " +
@@ -34,6 +36,9 @@ var (
"LEFT JOIN projections.users8_machines " +
"ON members.user_id = projections.users8_machines.user_id " +
"AND members.instance_id = projections.users8_machines.instance_id " +
"LEFT JOIN projections.users8 " +
"ON members.user_id = projections.users8.id " +
"AND members.instance_id = projections.users8.instance_id " +
"LEFT JOIN projections.login_names2 " +
"ON members.user_id = projections.login_names2.user_id " +
"AND members.instance_id = projections.login_names2.instance_id " +
@@ -53,6 +58,7 @@ var (
"display_name",
"name",
"avatar_key",
"type",
"count",
}
)
@@ -104,6 +110,7 @@ func Test_OrgMemberPrepares(t *testing.T) {
"display name",
nil,
nil,
domain.UserTypeHuman,
},
},
),
@@ -126,6 +133,7 @@ func Test_OrgMemberPrepares(t *testing.T) {
LastName: "last-name",
DisplayName: "display name",
AvatarURL: "",
UserType: domain.UserTypeHuman,
},
},
},
@@ -152,6 +160,7 @@ func Test_OrgMemberPrepares(t *testing.T) {
nil,
"machine-name",
nil,
domain.UserTypeMachine,
},
},
),
@@ -174,6 +183,7 @@ func Test_OrgMemberPrepares(t *testing.T) {
LastName: "",
DisplayName: "machine-name",
AvatarURL: "",
UserType: domain.UserTypeMachine,
},
},
},
@@ -200,6 +210,7 @@ func Test_OrgMemberPrepares(t *testing.T) {
"display name",
nil,
nil,
domain.UserTypeHuman,
},
{
testNow,
@@ -215,6 +226,7 @@ func Test_OrgMemberPrepares(t *testing.T) {
nil,
"machine-name",
nil,
domain.UserTypeMachine,
},
},
),
@@ -237,6 +249,7 @@ func Test_OrgMemberPrepares(t *testing.T) {
LastName: "last-name",
DisplayName: "display name",
AvatarURL: "",
UserType: domain.UserTypeHuman,
},
{
CreationDate: testNow,
@@ -251,6 +264,7 @@ func Test_OrgMemberPrepares(t *testing.T) {
LastName: "",
DisplayName: "machine-name",
AvatarURL: "",
UserType: domain.UserTypeMachine,
},
},
},