2021-01-04 14:52:13 +01:00
|
|
|
package domain
|
|
|
|
|
2021-01-15 09:32:59 +01:00
|
|
|
type User interface {
|
|
|
|
GetUsername() string
|
|
|
|
GetState() UserState
|
2021-01-05 09:33:45 +01:00
|
|
|
}
|
|
|
|
|
2021-01-04 14:52:13 +01:00
|
|
|
type UserState int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
UserStateUnspecified UserState = iota
|
|
|
|
UserStateActive
|
|
|
|
UserStateInactive
|
|
|
|
UserStateDeleted
|
|
|
|
UserStateLocked
|
|
|
|
UserStateSuspend
|
|
|
|
UserStateInitial
|
|
|
|
|
|
|
|
userStateCount
|
|
|
|
)
|
|
|
|
|
|
|
|
func (f UserState) Valid() bool {
|
|
|
|
return f >= 0 && f < userStateCount
|
|
|
|
}
|
2021-03-19 11:12:56 +01:00
|
|
|
|
|
|
|
func (s UserState) Exists() bool {
|
|
|
|
return s != UserStateUnspecified && s != UserStateDeleted
|
|
|
|
}
|
2021-11-23 10:31:23 +01:00
|
|
|
|
|
|
|
type UserType int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
UserTypeUnspecified UserType = iota
|
|
|
|
UserTypeHuman
|
|
|
|
UserTypeMachine
|
|
|
|
userTypeCount
|
|
|
|
)
|
|
|
|
|
|
|
|
func (f UserType) Valid() bool {
|
|
|
|
return f >= 0 && f < userTypeCount
|
|
|
|
}
|