mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-22 04:48:46 +00:00
feat: set metadata field in UpdateUser endpoint (#11747)
# Which Problems Are Solved To be able to update metadata via the `UpdateUser` endpoint. # How the Problems Are Solved This is achieved by: * adding the `Metadata` field to `UpdateUserRequest` * update the server layer to convert/set metadata fields to domain layer metadata * update the command layer to handle metadata updates # Additional Changes N/A # Additional Context - Related to https://github.com/zitadel/zitadel/issues/11369, https://github.com/zitadel/zitadel/issues/11759 - Follow-up for PR https://github.com/zitadel/zitadel/pull/11719 --------- Co-authored-by: Copilot <[email protected]>
This commit is contained in:
co-authored by
Copilot
parent
5b12690757
commit
282b2486d9
@@ -18,6 +18,7 @@ func Test_patchMachineUserToCommand(t *testing.T) {
|
||||
userId string
|
||||
userName *string
|
||||
machine *user.UpdateUserRequest_Machine
|
||||
metadata []*user.Metadata
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -45,6 +46,16 @@ func Test_patchMachineUserToCommand(t *testing.T) {
|
||||
Description: gu.Ptr("description"),
|
||||
AccessTokenType: gu.Ptr(user.AccessTokenType_ACCESS_TOKEN_TYPE_JWT),
|
||||
},
|
||||
metadata: []*user.Metadata{
|
||||
{
|
||||
Key: "key1",
|
||||
Value: []byte("value1"),
|
||||
},
|
||||
{
|
||||
Key: "key2",
|
||||
Value: []byte("value2"),
|
||||
},
|
||||
},
|
||||
},
|
||||
want: &command.ChangeMachine{
|
||||
ID: "userId",
|
||||
@@ -52,11 +63,21 @@ func Test_patchMachineUserToCommand(t *testing.T) {
|
||||
Name: gu.Ptr("name"),
|
||||
Description: gu.Ptr("description"),
|
||||
AccessTokenType: gu.Ptr(domain.OIDCTokenTypeJWT),
|
||||
Metadata: []*domain.Metadata{
|
||||
{
|
||||
Key: "key1",
|
||||
Value: []byte("value1"),
|
||||
},
|
||||
{
|
||||
Key: "key2",
|
||||
Value: []byte("value2"),
|
||||
},
|
||||
},
|
||||
},
|
||||
}}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := updateMachineUserToCommand(tt.args.userId, tt.args.userName, tt.args.machine)
|
||||
got := updateMachineUserToCommand(tt.args.userId, tt.args.userName, tt.args.machine, tt.args.metadata)
|
||||
if diff := cmp.Diff(tt.want, got, cmpopts.EquateComparable(language.Tag{})); diff != "" {
|
||||
t.Errorf("patchMachineUserToCommand() mismatch (-want +got):\n%s", diff)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user