zitadel/internal/domain/user.go
Silvan 861b777d9f
fix(projections): login names projection (#2698)
* refactor(domain): add user type

* fix(projections): start with login names

* fix(login_policy): correct handling of user domain claimed event

* refactor: login name projection

* fix: set correct suffixes on login name projections

* test(projections): login name reduces

* migration versioning

* refactor: use const for login name table name
2021-11-23 10:31:23 +01:00

42 lines
639 B
Go

package domain
type User interface {
GetUsername() string
GetState() UserState
}
type UserState int32
const (
UserStateUnspecified UserState = iota
UserStateActive
UserStateInactive
UserStateDeleted
UserStateLocked
UserStateSuspend
UserStateInitial
userStateCount
)
func (f UserState) Valid() bool {
return f >= 0 && f < userStateCount
}
func (s UserState) Exists() bool {
return s != UserStateUnspecified && s != UserStateDeleted
}
type UserType int32
const (
UserTypeUnspecified UserType = iota
UserTypeHuman
UserTypeMachine
userTypeCount
)
func (f UserType) Valid() bool {
return f >= 0 && f < userTypeCount
}