mirror of
https://github.com/zitadel/zitadel.git
synced 2025-07-01 15:08:55 +00:00

# Which Problems Are Solved the mapping of `ListUsers` was wrong for user states. # How the Problems Are Solved mapping of user state introduced to correctly map it # Additional Changes mapping of user type introduced to prevent same issue # Additional Context Requires backport to 2.x and 3.x Co-authored-by: Livio Spring <livio.a@gmail.com> (cherry picked from commit eb0eed21fa682774e476d0c720c501b37f0f7793)
38 lines
911 B
Go
38 lines
911 B
Go
package user
|
|
|
|
import "github.com/zitadel/zitadel/internal/domain"
|
|
|
|
type UserType = isUser_Type
|
|
|
|
func (s UserState) ToDomain() domain.UserState {
|
|
switch s {
|
|
case UserState_USER_STATE_UNSPECIFIED:
|
|
return domain.UserStateUnspecified
|
|
case UserState_USER_STATE_ACTIVE:
|
|
return domain.UserStateActive
|
|
case UserState_USER_STATE_INACTIVE:
|
|
return domain.UserStateInactive
|
|
case UserState_USER_STATE_DELETED:
|
|
return domain.UserStateDeleted
|
|
case UserState_USER_STATE_LOCKED:
|
|
return domain.UserStateLocked
|
|
case UserState_USER_STATE_INITIAL:
|
|
return domain.UserStateInitial
|
|
default:
|
|
return domain.UserStateUnspecified
|
|
}
|
|
}
|
|
|
|
func (t Type) ToDomain() domain.UserType {
|
|
switch t {
|
|
case Type_TYPE_UNSPECIFIED:
|
|
return domain.UserTypeUnspecified
|
|
case Type_TYPE_HUMAN:
|
|
return domain.UserTypeHuman
|
|
case Type_TYPE_MACHINE:
|
|
return domain.UserTypeMachine
|
|
default:
|
|
return domain.UserTypeUnspecified
|
|
}
|
|
}
|