mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
3549a8b64e
* move mgmt pkg * begin package restructure * rename auth package to authz * begin start api * move auth * move admin * fix merge * configs and interceptors * interceptor * revert generate-grpc.sh * some cleanups * console * move console * fix tests and merging * js linting * merge * merging and configs * change k8s base to current ports * fixes * cleanup * regenerate proto * remove unnecessary whitespace * missing param * go mod tidy * fix merging * move login pkg * cleanup * move api pkgs again * fix pkg naming * fix generate-static.sh for login * update workflow * fixes * logging * remove duplicate * comment for optional gateway interfaces * regenerate protos * fix proto imports for grpc web * protos * grpc web generate * grpc web generate * fix changes * add translation interceptor * fix merging * regenerate mgmt proto
71 lines
2.3 KiB
Go
71 lines
2.3 KiB
Go
package management
|
|
|
|
import (
|
|
"github.com/caos/logging"
|
|
|
|
"github.com/golang/protobuf/ptypes"
|
|
|
|
"github.com/caos/zitadel/internal/eventstore/models"
|
|
"github.com/caos/zitadel/internal/policy/model"
|
|
"github.com/caos/zitadel/pkg/grpc/management"
|
|
)
|
|
|
|
func passwordLockoutPolicyFromModel(policy *model.PasswordLockoutPolicy) *management.PasswordLockoutPolicy {
|
|
creationDate, err := ptypes.TimestampProto(policy.CreationDate)
|
|
logging.Log("GRPC-JRSbT").OnError(err).Debug("unable to parse timestamp")
|
|
|
|
changeDate, err := ptypes.TimestampProto(policy.ChangeDate)
|
|
logging.Log("GRPC-1sizr").OnError(err).Debug("unable to parse timestamp")
|
|
|
|
return &management.PasswordLockoutPolicy{
|
|
Id: policy.AggregateID,
|
|
CreationDate: creationDate,
|
|
ChangeDate: changeDate,
|
|
Sequence: policy.Sequence,
|
|
Description: policy.Description,
|
|
MaxAttempts: policy.MaxAttempts,
|
|
ShowLockOutFailures: policy.ShowLockOutFailures,
|
|
IsDefault: policy.AggregateID == "",
|
|
}
|
|
}
|
|
|
|
func passwordLockoutPolicyToModel(policy *management.PasswordLockoutPolicy) *model.PasswordLockoutPolicy {
|
|
creationDate, err := ptypes.Timestamp(policy.CreationDate)
|
|
logging.Log("GRPC-8a511").OnError(err).Debug("unable to parse timestamp")
|
|
|
|
changeDate, err := ptypes.Timestamp(policy.ChangeDate)
|
|
logging.Log("GRPC-2rdGv").OnError(err).Debug("unable to parse timestamp")
|
|
|
|
return &model.PasswordLockoutPolicy{
|
|
ObjectRoot: models.ObjectRoot{
|
|
AggregateID: policy.Id,
|
|
CreationDate: creationDate,
|
|
ChangeDate: changeDate,
|
|
Sequence: policy.Sequence,
|
|
},
|
|
Description: policy.Description,
|
|
|
|
MaxAttempts: policy.MaxAttempts,
|
|
ShowLockOutFailures: policy.ShowLockOutFailures,
|
|
}
|
|
}
|
|
|
|
func passwordLockoutPolicyCreateToModel(policy *management.PasswordLockoutPolicyCreate) *model.PasswordLockoutPolicy {
|
|
return &model.PasswordLockoutPolicy{
|
|
Description: policy.Description,
|
|
MaxAttempts: policy.MaxAttempts,
|
|
ShowLockOutFailures: policy.ShowLockOutFailures,
|
|
}
|
|
}
|
|
|
|
func passwordLockoutPolicyUpdateToModel(policy *management.PasswordLockoutPolicyUpdate) *model.PasswordLockoutPolicy {
|
|
return &model.PasswordLockoutPolicy{
|
|
ObjectRoot: models.ObjectRoot{
|
|
AggregateID: policy.Id,
|
|
},
|
|
Description: policy.Description,
|
|
MaxAttempts: policy.MaxAttempts,
|
|
ShowLockOutFailures: policy.ShowLockOutFailures,
|
|
}
|
|
}
|