mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
dc56e298ae
* fix: use domain models for v2 eventstore * fix: user domain model * Update internal/api/grpc/admin/login_policy_converter.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix: converter Co-authored-by: Livio Amstutz <livio.a@gmail.com>
56 lines
1.9 KiB
Go
56 lines
1.9 KiB
Go
package admin
|
|
|
|
import (
|
|
"github.com/caos/logging"
|
|
iam_model "github.com/caos/zitadel/internal/iam/model"
|
|
"github.com/caos/zitadel/internal/v2/domain"
|
|
"github.com/caos/zitadel/pkg/grpc/admin"
|
|
"github.com/golang/protobuf/ptypes"
|
|
)
|
|
|
|
func passwordComplexityPolicyToDomain(policy *admin.DefaultPasswordComplexityPolicyRequest) *domain.PasswordComplexityPolicy {
|
|
return &domain.PasswordComplexityPolicy{
|
|
MinLength: policy.MinLength,
|
|
HasUppercase: policy.HasUppercase,
|
|
HasLowercase: policy.HasLowercase,
|
|
HasNumber: policy.HasNumber,
|
|
HasSymbol: policy.HasSymbol,
|
|
}
|
|
}
|
|
|
|
func passwordComplexityPolicyFromDomain(policy *domain.PasswordComplexityPolicy) *admin.DefaultPasswordComplexityPolicy {
|
|
creationDate, err := ptypes.TimestampProto(policy.CreationDate)
|
|
logging.Log("GRPC-6Zhs9").OnError(err).Debug("date parse failed")
|
|
|
|
changeDate, err := ptypes.TimestampProto(policy.ChangeDate)
|
|
logging.Log("GRPC-bMso0").OnError(err).Debug("date parse failed")
|
|
|
|
return &admin.DefaultPasswordComplexityPolicy{
|
|
MinLength: policy.MinLength,
|
|
HasUppercase: policy.HasUppercase,
|
|
HasLowercase: policy.HasLowercase,
|
|
HasNumber: policy.HasNumber,
|
|
HasSymbol: policy.HasSymbol,
|
|
CreationDate: creationDate,
|
|
ChangeDate: changeDate,
|
|
}
|
|
}
|
|
|
|
func passwordComplexityPolicyViewFromModel(policy *iam_model.PasswordComplexityPolicyView) *admin.DefaultPasswordComplexityPolicyView {
|
|
creationDate, err := ptypes.TimestampProto(policy.CreationDate)
|
|
logging.Log("GRPC-rTs9f").OnError(err).Debug("date parse failed")
|
|
|
|
changeDate, err := ptypes.TimestampProto(policy.ChangeDate)
|
|
logging.Log("GRPC-ks9Zt").OnError(err).Debug("date parse failed")
|
|
|
|
return &admin.DefaultPasswordComplexityPolicyView{
|
|
MinLength: policy.MinLength,
|
|
HasUppercase: policy.HasUppercase,
|
|
HasLowercase: policy.HasLowercase,
|
|
HasNumber: policy.HasNumber,
|
|
HasSymbol: policy.HasSymbol,
|
|
CreationDate: creationDate,
|
|
ChangeDate: changeDate,
|
|
}
|
|
}
|