zitadel/internal/api/grpc/policy/domain_policy.go
Fabi 5c0f527a49
feat: restrict smtp sender address (#3637)
* fix: check if sender address is custom domain

* fix: check if sender address is custom domain

* fix: check if sender address is custom domain

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2022-05-16 14:08:47 +00:00

36 lines
1.0 KiB
Go

package policy
import (
"github.com/zitadel/zitadel/internal/api/grpc/object"
"github.com/zitadel/zitadel/internal/query"
policy_pb "github.com/zitadel/zitadel/pkg/grpc/policy"
)
func DomainPolicyToPb(policy *query.DomainPolicy) *policy_pb.DomainPolicy {
return &policy_pb.DomainPolicy{
UserLoginMustBeDomain: policy.UserLoginMustBeDomain,
ValidateOrgDomains: policy.ValidateOrgDomains,
SmtpSenderAddressMatchesInstanceDomain: policy.SMTPSenderAddressMatchesInstanceDomain,
IsDefault: policy.IsDefault,
Details: object.ToViewDetailsPb(
policy.Sequence,
policy.CreationDate,
policy.ChangeDate,
policy.ResourceOwner,
),
}
}
func DomainPolicyToOrgIAMPb(policy *query.DomainPolicy) *policy_pb.OrgIAMPolicy {
return &policy_pb.OrgIAMPolicy{
UserLoginMustBeDomain: policy.UserLoginMustBeDomain,
IsDefault: policy.IsDefault,
Details: object.ToViewDetailsPb(
policy.Sequence,
policy.CreationDate,
policy.ChangeDate,
policy.ResourceOwner,
),
}
}