fix: all enums same style (#262)

* fix: all enums same style

* fix: rename process to reduce

* add some missing enum renaming

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2020-06-23 14:47:47 +02:00
committed by GitHub
parent c376b92315
commit 3cd3a238c2
152 changed files with 1026 additions and 1024 deletions

View File

@@ -17,20 +17,20 @@ type OTP struct {
type MfaState int32
const (
MFASTATE_UNSPECIFIED MfaState = iota
MFASTATE_NOTREADY
MFASTATE_READY
MfaStateUnspecified MfaState = iota
MfaStateNotReady
MfaStateReady
)
type MultiFactor struct {
Type MFAType
Type MfaType
State MfaState
}
type MFAType int32
type MfaType int32
const (
MFATYPE_UNSPECIFIED MFAType = iota
MFATYPE_OTP
MFATYPE_SMS
MfaTypeUnspecified MfaType = iota
MfaTypeOTP
MfaTypeSMS
)

View File

@@ -36,8 +36,8 @@ type NotifyUserSearchRequest struct {
type NotifyUserSearchKey int32
const (
NOTIFYUSERSEARCHKEY_UNSPECIFIED UserSearchKey = iota
NOTIFYUSERSEARCHKEY_USER_ID
NotifyUserSearchKeyUnspecified UserSearchKey = iota
NotifyUserSearchKeyUserID
)
type NotifyUserSearchQuery struct {

View File

@@ -27,8 +27,8 @@ type PasswordCode struct {
type NotificationType int32
const (
NOTIFICATIONTYPE_EMAIL NotificationType = iota
NOTIFICATIONTYPE_SMS
NotificationTypeEmail NotificationType = iota
NotificationTypeSms
)
func (p *Password) IsValid() bool {

View File

@@ -50,22 +50,22 @@ type InitUserCode struct {
type UserState int32
const (
USERSTATE_UNSPECIFIED UserState = iota
USERSTATE_ACTIVE
USERSTATE_INACTIVE
USERSTATE_DELETED
USERSTATE_LOCKED
USERSTATE_SUSPEND
USERSTATE_INITIAL
UserStateUnspecified UserState = iota
UserStateActive
UserStateInactive
UserStateDeleted
UserStateLocked
UserStateSuspend
UserStateInitial
)
type Gender int32
const (
GENDER_UNDEFINED Gender = iota
GENDER_FEMALE
GENDER_MALE
GENDER_DIVERSE
GenderUnspecified Gender = iota
GenderFemale
GenderMale
GenderDiverse
)
func (u *User) CheckOrgIamPolicy(policy *org_model.OrgIamPolicy) error {
@@ -96,23 +96,23 @@ func (u *User) IsInitialState() bool {
}
func (u *User) IsActive() bool {
return u.State == USERSTATE_ACTIVE
return u.State == UserStateActive
}
func (u *User) IsInitial() bool {
return u.State == USERSTATE_INITIAL
return u.State == UserStateInitial
}
func (u *User) IsInactive() bool {
return u.State == USERSTATE_INACTIVE
return u.State == UserStateInactive
}
func (u *User) IsLocked() bool {
return u.State == USERSTATE_LOCKED
return u.State == UserStateLocked
}
func (u *User) IsOTPReady() bool {
return u.OTP != nil && u.OTP.State == MFASTATE_READY
return u.OTP != nil && u.OTP.State == MfaStateReady
}
func (u *User) HashPasswordIfExisting(policy *policy_model.PasswordComplexityPolicy, passwordAlg crypto.HashAlgorithm, onetime bool) error {

View File

@@ -36,11 +36,11 @@ type UserSessionSearchRequest struct {
type UserSessionSearchKey int32
const (
USERSESSIONSEARCHKEY_UNSPECIFIED UserSessionSearchKey = iota
USERSESSIONSEARCHKEY_USER_AGENT_ID
USERSESSIONSEARCHKEY_USER_ID
USERSESSIONSEARCHKEY_STATE
USERSESSIONSEARCHKEY_RESOURCEOWNER
UserSessionSearchKeyUnspecified UserSessionSearchKey = iota
UserSessionSearchKeyUserAgentID
UserSessionSearchKeyUserID
UserSessionSearchKeyState
UserSessionSearchKeyResourceOwner
)
type UserSessionSearchQuery struct {

View File

@@ -55,17 +55,17 @@ type UserSearchRequest struct {
type UserSearchKey int32
const (
USERSEARCHKEY_UNSPECIFIED UserSearchKey = iota
USERSEARCHKEY_USER_ID
USERSEARCHKEY_USER_NAME
USERSEARCHKEY_FIRST_NAME
USERSEARCHKEY_LAST_NAME
USERSEARCHKEY_NICK_NAME
USERSEARCHKEY_DISPLAY_NAME
USERSEARCHKEY_EMAIL
USERSEARCHKEY_STATE
USERSEARCHKEY_RESOURCEOWNER
USERSEARCHKEY_LOGIN_NAMES
UserSearchKeyUnspecified UserSearchKey = iota
UserSearchKeyUserID
UserSearchKeyUserName
UserSearchKeyFirstName
UserSearchKeyLastName
UserSearchKeyNickName
UserSearchKeyDisplayName
UserSearchKeyEmail
UserSearchKeyState
UserSearchKeyResourceOwner
UserSearchKeyLoginNames
)
type UserSearchQuery struct {
@@ -88,7 +88,7 @@ func (r *UserSearchRequest) EnsureLimit(limit uint64) {
}
func (r *UserSearchRequest) AppendMyOrgQuery(orgID string) {
r.Queries = append(r.Queries, &UserSearchQuery{Key: USERSEARCHKEY_RESOURCEOWNER, Method: model.SEARCHMETHOD_EQUALS, Value: orgID})
r.Queries = append(r.Queries, &UserSearchQuery{Key: UserSearchKeyResourceOwner, Method: model.SearchMethodEquals, Value: orgID})
}
func (u *UserView) MfaTypesSetupPossible(level req_model.MfaLevel) []req_model.MfaType {
@@ -97,7 +97,7 @@ func (u *UserView) MfaTypesSetupPossible(level req_model.MfaLevel) []req_model.M
default:
fallthrough
case req_model.MfaLevelSoftware:
if u.OTPState != MFASTATE_READY {
if u.OTPState != MfaStateReady {
types = append(types, req_model.MfaTypeOTP)
}
//PLANNED: add sms
@@ -114,7 +114,7 @@ func (u *UserView) MfaTypesAllowed(level req_model.MfaLevel) []req_model.MfaType
default:
fallthrough
case req_model.MfaLevelSoftware:
if u.OTPState == MFASTATE_READY {
if u.OTPState == MfaStateReady {
types = append(types, req_model.MfaTypeOTP)
}
//PLANNED: add sms