feat: New user (#1153)

* fix: use pointer in events

* fix: change user requests to command side

* fix: org policy

* fix: profile
This commit is contained in:
Fabi
2021-01-06 11:12:56 +01:00
committed by GitHub
parent 61d16e4621
commit 65a8efeb0e
51 changed files with 810 additions and 283 deletions

View File

@@ -21,8 +21,12 @@ func (rm *LabelPolicyReadModel) Reduce() error {
rm.SecondaryColor = e.SecondaryColor
rm.IsActive = true
case *policy.LabelPolicyChangedEvent:
rm.PrimaryColor = e.PrimaryColor
rm.SecondaryColor = e.SecondaryColor
if e.PrimaryColor != nil {
rm.PrimaryColor = *e.PrimaryColor
}
if e.SecondaryColor != nil {
rm.SecondaryColor = *e.SecondaryColor
}
case *policy.LabelPolicyRemovedEvent:
rm.IsActive = false
}

View File

@@ -28,11 +28,21 @@ func (rm *LoginPolicyReadModel) Reduce() error {
rm.PasswordlessType = e.PasswordlessType
rm.IsActive = true
case *policy.LoginPolicyChangedEvent:
rm.AllowUserNamePassword = e.AllowUserNamePassword
rm.AllowExternalIDP = e.AllowExternalIDP
rm.AllowRegister = e.AllowRegister
rm.ForceMFA = e.ForceMFA
rm.PasswordlessType = e.PasswordlessType
if e.AllowUserNamePassword != nil {
rm.AllowUserNamePassword = *e.AllowUserNamePassword
}
if e.AllowExternalIDP != nil {
rm.AllowExternalIDP = *e.AllowExternalIDP
}
if e.AllowRegister != nil {
rm.AllowRegister = *e.AllowRegister
}
if e.ForceMFA != nil {
rm.ForceMFA = *e.ForceMFA
}
if e.PasswordlessType != nil {
rm.PasswordlessType = *e.PasswordlessType
}
case *policy.LoginPolicyRemovedEvent:
rm.IsActive = false
}

View File

@@ -17,7 +17,9 @@ func (rm *OrgIAMPolicyReadModel) Reduce() error {
case *policy.OrgIAMPolicyAddedEvent:
rm.UserLoginMustBeDomain = e.UserLoginMustBeDomain
case *policy.OrgIAMPolicyChangedEvent:
rm.UserLoginMustBeDomain = e.UserLoginMustBeDomain
if e.UserLoginMustBeDomain != nil {
rm.UserLoginMustBeDomain = *e.UserLoginMustBeDomain
}
}
}
return rm.ReadModel.Reduce()

View File

@@ -19,8 +19,12 @@ func (rm *PasswordAgePolicyReadModel) Reduce() error {
rm.ExpireWarnDays = e.ExpireWarnDays
rm.MaxAgeDays = e.MaxAgeDays
case *policy.PasswordAgePolicyChangedEvent:
rm.ExpireWarnDays = e.ExpireWarnDays
rm.MaxAgeDays = e.MaxAgeDays
if e.ExpireWarnDays != nil {
rm.ExpireWarnDays = *e.ExpireWarnDays
}
if e.MaxAgeDays != nil {
rm.MaxAgeDays = *e.MaxAgeDays
}
}
}
return rm.ReadModel.Reduce()

View File

@@ -25,11 +25,21 @@ func (rm *PasswordComplexityPolicyReadModel) Reduce() error {
rm.HasNumber = e.HasNumber
rm.HasSymbol = e.HasSymbol
case *policy.PasswordComplexityPolicyChangedEvent:
rm.MinLength = e.MinLength
rm.HasLowercase = e.HasLowercase
rm.HasUpperCase = e.HasUpperCase
rm.HasNumber = e.HasNumber
rm.HasSymbol = e.HasSymbol
if e.MinLength != nil {
rm.MinLength = *e.MinLength
}
if e.HasLowercase != nil {
rm.HasLowercase = *e.HasLowercase
}
if e.HasUpperCase != nil {
rm.HasUpperCase = *e.HasUpperCase
}
if e.HasNumber != nil {
rm.HasNumber = *e.HasNumber
}
if e.HasSymbol != nil {
rm.HasSymbol = *e.HasSymbol
}
}
}
return rm.ReadModel.Reduce()

View File

@@ -19,8 +19,12 @@ func (rm *PasswordLockoutPolicyReadModel) Reduce() error {
rm.MaxAttempts = e.MaxAttempts
rm.ShowLockOutFailures = e.ShowLockOutFailures
case *policy.PasswordLockoutPolicyChangedEvent:
rm.MaxAttempts = e.MaxAttempts
rm.ShowLockOutFailures = e.ShowLockOutFailures
if e.MaxAttempts != nil {
rm.MaxAttempts = *e.MaxAttempts
}
if e.ShowLockOutFailures != nil {
rm.ShowLockOutFailures = *e.ShowLockOutFailures
}
}
}
return rm.ReadModel.Reduce()