mirror of
https://github.com/zitadel/zitadel
synced 2024-11-23 03:03:39 +00:00
861b777d9f
* 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
42 lines
639 B
Go
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
|
|
}
|