2021-01-04 13:52:13 +00:00
|
|
|
package domain
|
|
|
|
|
2021-01-15 08:32:59 +00:00
|
|
|
type User interface {
|
|
|
|
GetUsername() string
|
|
|
|
GetState() UserState
|
2021-01-05 08:33:45 +00:00
|
|
|
}
|
|
|
|
|
2021-01-04 13:52:13 +00: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 10:12:56 +00:00
|
|
|
|
|
|
|
func (s UserState) Exists() bool {
|
|
|
|
return s != UserStateUnspecified && s != UserStateDeleted
|
|
|
|
}
|
2021-11-23 09:31:23 +00:00
|
|
|
|
2022-10-07 11:56:50 +00:00
|
|
|
func (s UserState) NotDisabled() bool {
|
|
|
|
return s == UserStateActive || s == UserStateInitial
|
|
|
|
}
|
|
|
|
|
2021-11-23 09:31:23 +00:00
|
|
|
type UserType int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
UserTypeUnspecified UserType = iota
|
|
|
|
UserTypeHuman
|
|
|
|
UserTypeMachine
|
|
|
|
userTypeCount
|
|
|
|
)
|
|
|
|
|
|
|
|
func (f UserType) Valid() bool {
|
|
|
|
return f >= 0 && f < userTypeCount
|
|
|
|
}
|
2022-01-19 13:49:50 +00:00
|
|
|
|
|
|
|
type UserAuthMethodType int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
UserAuthMethodTypeUnspecified UserAuthMethodType = iota
|
|
|
|
UserAuthMethodTypeOTP
|
|
|
|
UserAuthMethodTypeU2F
|
|
|
|
UserAuthMethodTypePasswordless
|
|
|
|
userAuthMethodTypeCount
|
|
|
|
)
|
|
|
|
|
|
|
|
func (f UserAuthMethodType) Valid() bool {
|
|
|
|
return f >= 0 && f < userAuthMethodTypeCount
|
|
|
|
}
|
2022-02-08 08:37:28 +00:00
|
|
|
|
|
|
|
type PersonalAccessTokenState int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
PersonalAccessTokenStateUnspecified PersonalAccessTokenState = iota
|
|
|
|
PersonalAccessTokenStateActive
|
|
|
|
PersonalAccessTokenStateRemoved
|
|
|
|
|
|
|
|
personalAccessTokenStateCount
|
|
|
|
)
|
|
|
|
|
|
|
|
func (f PersonalAccessTokenState) Valid() bool {
|
|
|
|
return f >= 0 && f < personalAccessTokenStateCount
|
|
|
|
}
|