package management import ( "github.com/caos/logging" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/pkg/grpc/management" "github.com/golang/protobuf/ptypes" ) func passwordComplexityPolicyRequestToModel(policy *management.PasswordComplexityPolicyRequest) *iam_model.PasswordComplexityPolicy { return &iam_model.PasswordComplexityPolicy{ MinLength: policy.MinLength, HasLowercase: policy.HasLowercase, HasUppercase: policy.HasUppercase, HasSymbol: policy.HasSymbol, HasNumber: policy.HasNumber, } } func passwordComplexityPolicyFromModel(policy *iam_model.PasswordComplexityPolicy) *management.PasswordComplexityPolicy { creationDate, err := ptypes.TimestampProto(policy.CreationDate) logging.Log("GRPC-5Gslo").OnError(err).Debug("date parse failed") changeDate, err := ptypes.TimestampProto(policy.ChangeDate) logging.Log("GRPC-Bmd9e").OnError(err).Debug("date parse failed") return &management.PasswordComplexityPolicy{ MinLength: policy.MinLength, HasLowercase: policy.HasLowercase, HasUppercase: policy.HasUppercase, HasSymbol: policy.HasSymbol, HasNumber: policy.HasNumber, CreationDate: changeDate, ChangeDate: creationDate, } } func passwordComplexityPolicyViewFromModel(policy *iam_model.PasswordComplexityPolicyView) *management.PasswordComplexityPolicyView { creationDate, err := ptypes.TimestampProto(policy.CreationDate) logging.Log("GRPC-wmi8f").OnError(err).Debug("date parse failed") changeDate, err := ptypes.TimestampProto(policy.ChangeDate) logging.Log("GRPC-dmOp0").OnError(err).Debug("date parse failed") return &management.PasswordComplexityPolicyView{ Default: policy.Default, MinLength: policy.MinLength, HasLowercase: policy.HasLowercase, HasUppercase: policy.HasUppercase, HasSymbol: policy.HasSymbol, HasNumber: policy.HasNumber, CreationDate: changeDate, ChangeDate: creationDate, } }