mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-07 15:22:32 +00:00
chore: move converter methods users v2 to separate converter package + add tests (#10567)
# Which Problems Are Solved As requested by @adlerhurst in https://github.com/zitadel/zitadel/pull/10415#discussion_r2298087711 , I am moving the refactoring of v2 user converter methods to a separate PR # How the Problems Are Solved Cherry-pick648c234caf# Additional Context Parent of https://github.com/zitadel/zitadel/pull/10415 (cherry picked from commitb604615cab)
This commit is contained in:
27
internal/api/grpc/user/v2/convert/machine.go
Normal file
27
internal/api/grpc/user/v2/convert/machine.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package convert
|
||||
|
||||
import (
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/query"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/user/v2"
|
||||
)
|
||||
|
||||
func machineToPb(userQ *query.Machine) *user.MachineUser {
|
||||
return &user.MachineUser{
|
||||
Name: userQ.Name,
|
||||
Description: userQ.Description,
|
||||
HasSecret: userQ.EncodedSecret != "",
|
||||
AccessTokenType: accessTokenTypeToPb(userQ.AccessTokenType),
|
||||
}
|
||||
}
|
||||
|
||||
func accessTokenTypeToPb(accessTokenType domain.OIDCTokenType) user.AccessTokenType {
|
||||
switch accessTokenType {
|
||||
case domain.OIDCTokenTypeBearer:
|
||||
return user.AccessTokenType_ACCESS_TOKEN_TYPE_BEARER
|
||||
case domain.OIDCTokenTypeJWT:
|
||||
return user.AccessTokenType_ACCESS_TOKEN_TYPE_JWT
|
||||
default:
|
||||
return user.AccessTokenType_ACCESS_TOKEN_TYPE_BEARER
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user