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
@@ -47,8 +47,8 @@ func (s *Server) createUserTypeMachine(ctx context.Context, machinePb *user.Crea
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (s *Server) updateUserTypeMachine(ctx context.Context, machinePb *user.UpdateUserRequest_Machine, userId string, userName *string) (*connect.Response[user.UpdateUserResponse], error) {
|
||||
cmd := updateMachineUserToCommand(userId, userName, machinePb)
|
||||
func (s *Server) updateUserTypeMachine(ctx context.Context, machinePb *user.UpdateUserRequest_Machine, userId string, userName *string, reqMetadata []*user.Metadata) (*connect.Response[user.UpdateUserResponse], error) {
|
||||
cmd := updateMachineUserToCommand(userId, userName, machinePb, reqMetadata)
|
||||
err := s.command.ChangeUserMachine(ctx, cmd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -58,7 +58,7 @@ func (s *Server) updateUserTypeMachine(ctx context.Context, machinePb *user.Upda
|
||||
}), nil
|
||||
}
|
||||
|
||||
func updateMachineUserToCommand(userId string, userName *string, machine *user.UpdateUserRequest_Machine) *command.ChangeMachine {
|
||||
func updateMachineUserToCommand(userId string, userName *string, machine *user.UpdateUserRequest_Machine, reqMetadata []*user.Metadata) *command.ChangeMachine {
|
||||
var accessTokenType *domain.OIDCTokenType
|
||||
if machine.AccessTokenType != nil {
|
||||
tokenType := accessTokenTypeToDomain(*machine.AccessTokenType)
|
||||
@@ -70,6 +70,7 @@ func updateMachineUserToCommand(userId string, userName *string, machine *user.U
|
||||
Name: machine.Name,
|
||||
Description: machine.Description,
|
||||
AccessTokenType: accessTokenType,
|
||||
Metadata: setUserMetadataToDomain(reqMetadata),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user