mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-08 15:37:41 +00:00
feat: validate org domains (#3387)
* feat: validate org domain command side * feat: validate org domain query side * fix: create domain policy * feat: add reading domain policy on addorg domain
This commit is contained in:
parent
db554536a1
commit
820a21dce3
@ -100,6 +100,7 @@ S3DefaultInstance:
|
|||||||
MaxAgeDays: 0
|
MaxAgeDays: 0
|
||||||
DomainPolicy:
|
DomainPolicy:
|
||||||
UserLoginMustBeDomain: true
|
UserLoginMustBeDomain: true
|
||||||
|
ValidateOrgDomains: true
|
||||||
LoginPolicy:
|
LoginPolicy:
|
||||||
AllowUsernamePassword: true
|
AllowUsernamePassword: true
|
||||||
AllowRegister: true
|
AllowRegister: true
|
||||||
|
@ -1493,6 +1493,7 @@ This is an empty request
|
|||||||
| ----- | ---- | ----------- | ----------- |
|
| ----- | ---- | ----------- | ----------- |
|
||||||
| org_id | string | - | string.min_len: 1<br /> string.max_len: 200<br /> |
|
| org_id | string | - | string.min_len: 1<br /> string.max_len: 200<br /> |
|
||||||
| user_login_must_be_domain | bool | the username has to end with the domain of it's organisation (uniqueness is organisation based) | |
|
| user_login_must_be_domain | bool | the username has to end with the domain of it's organisation (uniqueness is organisation based) | |
|
||||||
|
| validate_org_domains | bool | - | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -3676,6 +3677,7 @@ This is an empty request
|
|||||||
| ----- | ---- | ----------- | ----------- |
|
| ----- | ---- | ----------- | ----------- |
|
||||||
| org_id | string | - | string.min_len: 1<br /> string.max_len: 200<br /> |
|
| org_id | string | - | string.min_len: 1<br /> string.max_len: 200<br /> |
|
||||||
| user_login_must_be_domain | bool | - | |
|
| user_login_must_be_domain | bool | - | |
|
||||||
|
| validate_org_domains | bool | - | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -3721,6 +3723,7 @@ This is an empty request
|
|||||||
| Field | Type | Description | Validation |
|
| Field | Type | Description | Validation |
|
||||||
| ----- | ---- | ----------- | ----------- |
|
| ----- | ---- | ----------- | ----------- |
|
||||||
| user_login_must_be_domain | bool | - | |
|
| user_login_must_be_domain | bool | - | |
|
||||||
|
| validate_org_domains | bool | - | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ title: zitadel/policy.proto
|
|||||||
| details | zitadel.v1.ObjectDetails | - | |
|
| details | zitadel.v1.ObjectDetails | - | |
|
||||||
| user_login_must_be_domain | bool | - | |
|
| user_login_must_be_domain | bool | - | |
|
||||||
| is_default | bool | - | |
|
| is_default | bool | - | |
|
||||||
|
| validate_org_domains | bool | - | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ func (s *Server) GetCustomDomainPolicy(ctx context.Context, req *admin_pb.GetCus
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) AddCustomDomainPolicy(ctx context.Context, req *admin_pb.AddCustomDomainPolicyRequest) (*admin_pb.AddCustomDomainPolicyResponse, error) {
|
func (s *Server) AddCustomDomainPolicy(ctx context.Context, req *admin_pb.AddCustomDomainPolicyRequest) (*admin_pb.AddCustomDomainPolicyResponse, error) {
|
||||||
policy, err := s.command.AddOrgDomainPolicy(ctx, req.OrgId, domainPolicyToDomain(req.UserLoginMustBeDomain))
|
policy, err := s.command.AddOrgDomainPolicy(ctx, req.OrgId, domainPolicyToDomain(req.UserLoginMustBeDomain, req.ValidateOrgDomains))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -76,9 +76,10 @@ func (s *Server) ResetCustomDomainPolicyTo(ctx context.Context, req *admin_pb.Re
|
|||||||
return nil, nil //TOOD: return data
|
return nil, nil //TOOD: return data
|
||||||
}
|
}
|
||||||
|
|
||||||
func domainPolicyToDomain(userLoginMustBeDomain bool) *domain.DomainPolicy {
|
func domainPolicyToDomain(userLoginMustBeDomain, validateOrgDomains bool) *domain.DomainPolicy {
|
||||||
return &domain.DomainPolicy{
|
return &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: userLoginMustBeDomain,
|
UserLoginMustBeDomain: userLoginMustBeDomain,
|
||||||
|
ValidateOrgDomains: validateOrgDomains,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +89,7 @@ func updateDomainPolicyToDomain(req *admin_pb.UpdateDomainPolicyRequest) *domain
|
|||||||
// // AggreagateID: //TODO: there should only be ONE default
|
// // AggreagateID: //TODO: there should only be ONE default
|
||||||
// },
|
// },
|
||||||
UserLoginMustBeDomain: req.UserLoginMustBeDomain,
|
UserLoginMustBeDomain: req.UserLoginMustBeDomain,
|
||||||
|
ValidateOrgDomains: req.ValidateOrgDomains,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,11 +99,12 @@ func updateCustomDomainPolicyToDomain(req *admin_pb.UpdateCustomDomainPolicyRequ
|
|||||||
AggregateID: req.OrgId,
|
AggregateID: req.OrgId,
|
||||||
},
|
},
|
||||||
UserLoginMustBeDomain: req.UserLoginMustBeDomain,
|
UserLoginMustBeDomain: req.UserLoginMustBeDomain,
|
||||||
|
ValidateOrgDomains: req.ValidateOrgDomains,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) AddCustomOrgIAMPolicy(ctx context.Context, req *admin_pb.AddCustomOrgIAMPolicyRequest) (*admin_pb.AddCustomOrgIAMPolicyResponse, error) {
|
func (s *Server) AddCustomOrgIAMPolicy(ctx context.Context, req *admin_pb.AddCustomOrgIAMPolicyRequest) (*admin_pb.AddCustomOrgIAMPolicyResponse, error) {
|
||||||
policy, err := s.command.AddOrgDomainPolicy(ctx, req.OrgId, domainPolicyToDomain(req.UserLoginMustBeDomain))
|
policy, err := s.command.AddOrgDomainPolicy(ctx, req.OrgId, domainPolicyToDomain(req.UserLoginMustBeDomain, true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -161,6 +164,7 @@ func (s *Server) GetCustomOrgIAMPolicy(ctx context.Context, req *admin_pb.GetCus
|
|||||||
func updateOrgIAMPolicyToDomain(req *admin_pb.UpdateOrgIAMPolicyRequest) *domain.DomainPolicy {
|
func updateOrgIAMPolicyToDomain(req *admin_pb.UpdateOrgIAMPolicyRequest) *domain.DomainPolicy {
|
||||||
return &domain.DomainPolicy{
|
return &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: req.UserLoginMustBeDomain,
|
UserLoginMustBeDomain: req.UserLoginMustBeDomain,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,5 +174,6 @@ func updateCustomOrgIAMPolicyToDomain(req *admin_pb.UpdateCustomOrgIAMPolicyRequ
|
|||||||
AggregateID: req.OrgId,
|
AggregateID: req.OrgId,
|
||||||
},
|
},
|
||||||
UserLoginMustBeDomain: req.UserLoginMustBeDomain,
|
UserLoginMustBeDomain: req.UserLoginMustBeDomain,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
func DomainPolicyToPb(policy *query.DomainPolicy) *policy_pb.DomainPolicy {
|
func DomainPolicyToPb(policy *query.DomainPolicy) *policy_pb.DomainPolicy {
|
||||||
return &policy_pb.DomainPolicy{
|
return &policy_pb.DomainPolicy{
|
||||||
UserLoginMustBeDomain: policy.UserLoginMustBeDomain,
|
UserLoginMustBeDomain: policy.UserLoginMustBeDomain,
|
||||||
|
ValidateOrgDomains: policy.ValidateOrgDomains,
|
||||||
IsDefault: policy.IsDefault,
|
IsDefault: policy.IsDefault,
|
||||||
Details: object.ToViewDetailsPb(
|
Details: object.ToViewDetailsPb(
|
||||||
policy.Sequence,
|
policy.Sequence,
|
||||||
|
@ -78,6 +78,7 @@ type InstanceSetup struct {
|
|||||||
}
|
}
|
||||||
DomainPolicy struct {
|
DomainPolicy struct {
|
||||||
UserLoginMustBeDomain bool
|
UserLoginMustBeDomain bool
|
||||||
|
ValidateOrgDomains bool
|
||||||
}
|
}
|
||||||
LoginPolicy struct {
|
LoginPolicy struct {
|
||||||
AllowUsernamePassword bool
|
AllowUsernamePassword bool
|
||||||
@ -242,6 +243,7 @@ func (c *commandNew) SetUpInstance(ctx context.Context, setup *InstanceSetup) (*
|
|||||||
AddDefaultDomainPolicy(
|
AddDefaultDomainPolicy(
|
||||||
instanceAgg,
|
instanceAgg,
|
||||||
setup.DomainPolicy.UserLoginMustBeDomain,
|
setup.DomainPolicy.UserLoginMustBeDomain,
|
||||||
|
setup.DomainPolicy.ValidateOrgDomains,
|
||||||
),
|
),
|
||||||
AddDefaultLoginPolicy(
|
AddDefaultLoginPolicy(
|
||||||
instanceAgg,
|
instanceAgg,
|
||||||
|
@ -69,6 +69,7 @@ func writeModelToDomainPolicy(wm *InstanceDomainPolicyWriteModel) *domain.Domain
|
|||||||
return &domain.DomainPolicy{
|
return &domain.DomainPolicy{
|
||||||
ObjectRoot: writeModelToObjectRoot(wm.PolicyDomainWriteModel.WriteModel),
|
ObjectRoot: writeModelToObjectRoot(wm.PolicyDomainWriteModel.WriteModel),
|
||||||
UserLoginMustBeDomain: wm.UserLoginMustBeDomain,
|
UserLoginMustBeDomain: wm.UserLoginMustBeDomain,
|
||||||
|
ValidateOrgDomains: wm.ValidateOrgDomains,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,8 @@ import (
|
|||||||
|
|
||||||
func AddDefaultDomainPolicy(
|
func AddDefaultDomainPolicy(
|
||||||
a *instance.Aggregate,
|
a *instance.Aggregate,
|
||||||
userLoginMustBeDomain bool,
|
userLoginMustBeDomain,
|
||||||
|
validateOrgDomains bool,
|
||||||
) preparation.Validation {
|
) preparation.Validation {
|
||||||
return func() (preparation.CreateCommands, error) {
|
return func() (preparation.CreateCommands, error) {
|
||||||
return func(ctx context.Context, filter preparation.FilterToQueryReducer) ([]eventstore.Command, error) {
|
return func(ctx context.Context, filter preparation.FilterToQueryReducer) ([]eventstore.Command, error) {
|
||||||
@ -18,6 +19,7 @@ func AddDefaultDomainPolicy(
|
|||||||
return []eventstore.Command{
|
return []eventstore.Command{
|
||||||
instance.NewDomainPolicyAddedEvent(ctx, &a.Aggregate,
|
instance.NewDomainPolicyAddedEvent(ctx, &a.Aggregate,
|
||||||
userLoginMustBeDomain,
|
userLoginMustBeDomain,
|
||||||
|
validateOrgDomains,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -37,7 +37,7 @@ func (c *Commands) addDefaultDomainPolicy(ctx context.Context, instanceAgg *even
|
|||||||
if addedPolicy.State == domain.PolicyStateActive {
|
if addedPolicy.State == domain.PolicyStateActive {
|
||||||
return nil, caos_errs.ThrowAlreadyExists(nil, "INSTANCE-Lk0dS", "Errors.IAM.DomainPolicy.AlreadyExists")
|
return nil, caos_errs.ThrowAlreadyExists(nil, "INSTANCE-Lk0dS", "Errors.IAM.DomainPolicy.AlreadyExists")
|
||||||
}
|
}
|
||||||
return iam_repo.NewDomainPolicyAddedEvent(ctx, instanceAgg, policy.UserLoginMustBeDomain), nil
|
return iam_repo.NewDomainPolicyAddedEvent(ctx, instanceAgg, policy.UserLoginMustBeDomain, policy.ValidateOrgDomains), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Commands) ChangeDefaultDomainPolicy(ctx context.Context, policy *domain.DomainPolicy) (*domain.DomainPolicy, error) {
|
func (c *Commands) ChangeDefaultDomainPolicy(ctx context.Context, policy *domain.DomainPolicy) (*domain.DomainPolicy, error) {
|
||||||
@ -50,7 +50,7 @@ func (c *Commands) ChangeDefaultDomainPolicy(ctx context.Context, policy *domain
|
|||||||
}
|
}
|
||||||
|
|
||||||
instanceAgg := InstanceAggregateFromWriteModel(&existingPolicy.PolicyDomainWriteModel.WriteModel)
|
instanceAgg := InstanceAggregateFromWriteModel(&existingPolicy.PolicyDomainWriteModel.WriteModel)
|
||||||
changedEvent, hasChanged := existingPolicy.NewChangedEvent(ctx, instanceAgg, policy.UserLoginMustBeDomain)
|
changedEvent, hasChanged := existingPolicy.NewChangedEvent(ctx, instanceAgg, policy.UserLoginMustBeDomain, policy.ValidateOrgDomains)
|
||||||
if !hasChanged {
|
if !hasChanged {
|
||||||
return nil, caos_errs.ThrowPreconditionFailed(nil, "INSTANCE-4M9vs", "Errors.IAM.LabelPolicy.NotChanged")
|
return nil, caos_errs.ThrowPreconditionFailed(nil, "INSTANCE-4M9vs", "Errors.IAM.LabelPolicy.NotChanged")
|
||||||
}
|
}
|
||||||
|
@ -55,11 +55,15 @@ func (wm *InstanceDomainPolicyWriteModel) Query() *eventstore.SearchQueryBuilder
|
|||||||
func (wm *InstanceDomainPolicyWriteModel) NewChangedEvent(
|
func (wm *InstanceDomainPolicyWriteModel) NewChangedEvent(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
aggregate *eventstore.Aggregate,
|
aggregate *eventstore.Aggregate,
|
||||||
userLoginMustBeDomain bool) (*instance.DomainPolicyChangedEvent, bool) {
|
userLoginMustBeDomain,
|
||||||
changes := make([]policy.OrgPolicyChanges, 0)
|
validateOrgDomain bool) (*instance.DomainPolicyChangedEvent, bool) {
|
||||||
|
changes := make([]policy.DomainPolicyChanges, 0)
|
||||||
if wm.UserLoginMustBeDomain != userLoginMustBeDomain {
|
if wm.UserLoginMustBeDomain != userLoginMustBeDomain {
|
||||||
changes = append(changes, policy.ChangeUserLoginMustBeDomain(userLoginMustBeDomain))
|
changes = append(changes, policy.ChangeUserLoginMustBeDomain(userLoginMustBeDomain))
|
||||||
}
|
}
|
||||||
|
if wm.ValidateOrgDomains != validateOrgDomain {
|
||||||
|
changes = append(changes, policy.ChangeValidateOrgDomains(validateOrgDomain))
|
||||||
|
}
|
||||||
if len(changes) == 0 {
|
if len(changes) == 0 {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ func TestCommandSide_AddDefaultDomainPolicy(t *testing.T) {
|
|||||||
instance.NewDomainPolicyAddedEvent(context.Background(),
|
instance.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&instance.NewAggregate("INSTANCE").Aggregate,
|
&instance.NewAggregate("INSTANCE").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -52,6 +53,7 @@ func TestCommandSide_AddDefaultDomainPolicy(t *testing.T) {
|
|||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -71,6 +73,7 @@ func TestCommandSide_AddDefaultDomainPolicy(t *testing.T) {
|
|||||||
instance.NewDomainPolicyAddedEvent(context.Background(),
|
instance.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&instance.NewAggregate("INSTANCE").Aggregate,
|
&instance.NewAggregate("INSTANCE").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -81,6 +84,7 @@ func TestCommandSide_AddDefaultDomainPolicy(t *testing.T) {
|
|||||||
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
|
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -91,6 +95,7 @@ func TestCommandSide_AddDefaultDomainPolicy(t *testing.T) {
|
|||||||
ResourceOwner: "INSTANCE",
|
ResourceOwner: "INSTANCE",
|
||||||
},
|
},
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -144,6 +149,7 @@ func TestCommandSide_ChangeDefaultDomainPolicy(t *testing.T) {
|
|||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -160,6 +166,7 @@ func TestCommandSide_ChangeDefaultDomainPolicy(t *testing.T) {
|
|||||||
instance.NewDomainPolicyAddedEvent(context.Background(),
|
instance.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&instance.NewAggregate("INSTANCE").Aggregate,
|
&instance.NewAggregate("INSTANCE").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -169,6 +176,7 @@ func TestCommandSide_ChangeDefaultDomainPolicy(t *testing.T) {
|
|||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -185,13 +193,14 @@ func TestCommandSide_ChangeDefaultDomainPolicy(t *testing.T) {
|
|||||||
instance.NewDomainPolicyAddedEvent(context.Background(),
|
instance.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&instance.NewAggregate("INSTANCE").Aggregate,
|
&instance.NewAggregate("INSTANCE").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
expectPush(
|
expectPush(
|
||||||
[]*repository.Event{
|
[]*repository.Event{
|
||||||
eventFromEventPusher(
|
eventFromEventPusher(
|
||||||
newDefaultDomainPolicyChangedEvent(context.Background(), false),
|
newDefaultDomainPolicyChangedEvent(context.Background(), false, false),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -201,6 +210,7 @@ func TestCommandSide_ChangeDefaultDomainPolicy(t *testing.T) {
|
|||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: false,
|
UserLoginMustBeDomain: false,
|
||||||
|
ValidateOrgDomains: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -210,6 +220,7 @@ func TestCommandSide_ChangeDefaultDomainPolicy(t *testing.T) {
|
|||||||
ResourceOwner: "INSTANCE",
|
ResourceOwner: "INSTANCE",
|
||||||
},
|
},
|
||||||
UserLoginMustBeDomain: false,
|
UserLoginMustBeDomain: false,
|
||||||
|
ValidateOrgDomains: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -233,11 +244,12 @@ func TestCommandSide_ChangeDefaultDomainPolicy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDefaultDomainPolicyChangedEvent(ctx context.Context, userLoginMustBeDomain bool) *instance.DomainPolicyChangedEvent {
|
func newDefaultDomainPolicyChangedEvent(ctx context.Context, userLoginMustBeDomain, validateOrgDomains bool) *instance.DomainPolicyChangedEvent {
|
||||||
event, _ := instance.NewDomainPolicyChangedEvent(ctx,
|
event, _ := instance.NewDomainPolicyChangedEvent(ctx,
|
||||||
&instance.NewAggregate("INSTANCE").Aggregate,
|
&instance.NewAggregate("INSTANCE").Aggregate,
|
||||||
[]policy.OrgPolicyChanges{
|
[]policy.DomainPolicyChanges{
|
||||||
policy.ChangeUserLoginMustBeDomain(userLoginMustBeDomain),
|
policy.ChangeUserLoginMustBeDomain(userLoginMustBeDomain),
|
||||||
|
policy.ChangeValidateOrgDomains(validateOrgDomains),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return event
|
return event
|
||||||
|
@ -17,6 +17,7 @@ func orgWriteModelToDomainPolicy(wm *OrgDomainPolicyWriteModel) *domain.DomainPo
|
|||||||
return &domain.DomainPolicy{
|
return &domain.DomainPolicy{
|
||||||
ObjectRoot: writeModelToObjectRoot(wm.PolicyDomainWriteModel.WriteModel),
|
ObjectRoot: writeModelToObjectRoot(wm.PolicyDomainWriteModel.WriteModel),
|
||||||
UserLoginMustBeDomain: wm.UserLoginMustBeDomain,
|
UserLoginMustBeDomain: wm.UserLoginMustBeDomain,
|
||||||
|
ValidateOrgDomains: wm.ValidateOrgDomains,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,12 +2,11 @@ package command
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
errs "errors"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/caos/logging"
|
"github.com/caos/logging"
|
||||||
|
|
||||||
errs "errors"
|
|
||||||
|
|
||||||
http_utils "github.com/caos/zitadel/internal/api/http"
|
http_utils "github.com/caos/zitadel/internal/api/http"
|
||||||
"github.com/caos/zitadel/internal/command/preparation"
|
"github.com/caos/zitadel/internal/command/preparation"
|
||||||
"github.com/caos/zitadel/internal/crypto"
|
"github.com/caos/zitadel/internal/crypto"
|
||||||
@ -30,7 +29,15 @@ func AddOrgDomain(a *org.Aggregate, domain string) preparation.Validation {
|
|||||||
if existing != nil && existing.Verified {
|
if existing != nil && existing.Verified {
|
||||||
return nil, errors.ThrowAlreadyExists(nil, "V2-e1wse", "Errors.Already.Exists")
|
return nil, errors.ThrowAlreadyExists(nil, "V2-e1wse", "Errors.Already.Exists")
|
||||||
}
|
}
|
||||||
return []eventstore.Command{org.NewDomainAddedEvent(ctx, &a.Aggregate, domain)}, nil
|
domainPolicy, err := domainPolicyWriteModel(ctx, filter)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
events := []eventstore.Command{org.NewDomainAddedEvent(ctx, &a.Aggregate, domain)}
|
||||||
|
if !domainPolicy.ValidateOrgDomains {
|
||||||
|
events = append(events, org.NewDomainVerifiedEvent(ctx, &a.Aggregate, domain))
|
||||||
|
}
|
||||||
|
return events, nil
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,12 +47,14 @@ func TestAddDomain(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "correct",
|
name: "correct (should verify domain)",
|
||||||
args: args{
|
args: args{
|
||||||
a: agg,
|
a: agg,
|
||||||
domain: "domain",
|
domain: "domain",
|
||||||
filter: func(ctx context.Context, queryFactory *eventstore.SearchQueryBuilder) ([]eventstore.Event, error) {
|
filter: func(ctx context.Context, queryFactory *eventstore.SearchQueryBuilder) ([]eventstore.Event, error) {
|
||||||
return nil, nil
|
return []eventstore.Event{
|
||||||
|
org.NewDomainPolicyAddedEvent(ctx, &agg.Aggregate, true, true),
|
||||||
|
}, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: Want{
|
want: Want{
|
||||||
@ -61,6 +63,24 @@ func TestAddDomain(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "correct (should not verify domain)",
|
||||||
|
args: args{
|
||||||
|
a: agg,
|
||||||
|
domain: "domain",
|
||||||
|
filter: func(ctx context.Context, queryFactory *eventstore.SearchQueryBuilder) ([]eventstore.Event, error) {
|
||||||
|
return []eventstore.Event{
|
||||||
|
org.NewDomainPolicyAddedEvent(ctx, &agg.Aggregate, true, false),
|
||||||
|
}, nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: Want{
|
||||||
|
Commands: []eventstore.Command{
|
||||||
|
org.NewDomainAddedEvent(context.Background(), &agg.Aggregate, "domain"),
|
||||||
|
org.NewDomainVerifiedEvent(context.Background(), &agg.Aggregate, "domain"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "already verified",
|
name: "already verified",
|
||||||
args: args{
|
args: args{
|
||||||
@ -1022,7 +1042,7 @@ func TestCommandSide_ValidateOrgDomain(t *testing.T) {
|
|||||||
eventFromEventPusher(
|
eventFromEventPusher(
|
||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org2", "org2").Aggregate,
|
&org.NewAggregate("org2", "org2").Aggregate,
|
||||||
false))),
|
false, false))),
|
||||||
expectPush(
|
expectPush(
|
||||||
[]*repository.Event{
|
[]*repository.Event{
|
||||||
eventFromEventPusher(org.NewDomainVerifiedEvent(context.Background(),
|
eventFromEventPusher(org.NewDomainVerifiedEvent(context.Background(),
|
||||||
|
@ -39,7 +39,7 @@ func (c *Commands) addOrgDomainPolicy(ctx context.Context, orgAgg *eventstore.Ag
|
|||||||
if addedPolicy.State == domain.PolicyStateActive {
|
if addedPolicy.State == domain.PolicyStateActive {
|
||||||
return nil, caos_errs.ThrowAlreadyExists(nil, "ORG-1M8ds", "Errors.Org.DomainPolicy.AlreadyExists")
|
return nil, caos_errs.ThrowAlreadyExists(nil, "ORG-1M8ds", "Errors.Org.DomainPolicy.AlreadyExists")
|
||||||
}
|
}
|
||||||
return org.NewDomainPolicyAddedEvent(ctx, orgAgg, policy.UserLoginMustBeDomain), nil
|
return org.NewDomainPolicyAddedEvent(ctx, orgAgg, policy.UserLoginMustBeDomain, policy.ValidateOrgDomains), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Commands) ChangeOrgDomainPolicy(ctx context.Context, resourceOwner string, policy *domain.DomainPolicy) (*domain.DomainPolicy, error) {
|
func (c *Commands) ChangeOrgDomainPolicy(ctx context.Context, resourceOwner string, policy *domain.DomainPolicy) (*domain.DomainPolicy, error) {
|
||||||
@ -55,7 +55,7 @@ func (c *Commands) ChangeOrgDomainPolicy(ctx context.Context, resourceOwner stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
orgAgg := OrgAggregateFromWriteModel(&existingPolicy.PolicyDomainWriteModel.WriteModel)
|
orgAgg := OrgAggregateFromWriteModel(&existingPolicy.PolicyDomainWriteModel.WriteModel)
|
||||||
changedEvent, hasChanged := existingPolicy.NewChangedEvent(ctx, orgAgg, policy.UserLoginMustBeDomain)
|
changedEvent, hasChanged := existingPolicy.NewChangedEvent(ctx, orgAgg, policy.UserLoginMustBeDomain, policy.ValidateOrgDomains)
|
||||||
if !hasChanged {
|
if !hasChanged {
|
||||||
return nil, caos_errs.ThrowPreconditionFailed(nil, "ORG-3M9ds", "Errors.Org.LabelPolicy.NotChanged")
|
return nil, caos_errs.ThrowPreconditionFailed(nil, "ORG-3M9ds", "Errors.Org.LabelPolicy.NotChanged")
|
||||||
}
|
}
|
||||||
|
@ -56,11 +56,15 @@ func (wm *OrgDomainPolicyWriteModel) Query() *eventstore.SearchQueryBuilder {
|
|||||||
func (wm *OrgDomainPolicyWriteModel) NewChangedEvent(
|
func (wm *OrgDomainPolicyWriteModel) NewChangedEvent(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
aggregate *eventstore.Aggregate,
|
aggregate *eventstore.Aggregate,
|
||||||
userLoginMustBeDomain bool) (*org.DomainPolicyChangedEvent, bool) {
|
userLoginMustBeDomain,
|
||||||
changes := make([]policy.OrgPolicyChanges, 0)
|
validateOrgDomains bool) (*org.DomainPolicyChangedEvent, bool) {
|
||||||
|
changes := make([]policy.DomainPolicyChanges, 0)
|
||||||
if wm.UserLoginMustBeDomain != userLoginMustBeDomain {
|
if wm.UserLoginMustBeDomain != userLoginMustBeDomain {
|
||||||
changes = append(changes, policy.ChangeUserLoginMustBeDomain(userLoginMustBeDomain))
|
changes = append(changes, policy.ChangeUserLoginMustBeDomain(userLoginMustBeDomain))
|
||||||
}
|
}
|
||||||
|
if wm.ValidateOrgDomains != validateOrgDomains {
|
||||||
|
changes = append(changes, policy.ChangeValidateOrgDomains(validateOrgDomains))
|
||||||
|
}
|
||||||
if len(changes) == 0 {
|
if len(changes) == 0 {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ func TestCommandSide_AddDomainPolicy(t *testing.T) {
|
|||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -61,6 +62,7 @@ func TestCommandSide_AddDomainPolicy(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -71,6 +73,7 @@ func TestCommandSide_AddDomainPolicy(t *testing.T) {
|
|||||||
orgID: "org1",
|
orgID: "org1",
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -89,6 +92,7 @@ func TestCommandSide_AddDomainPolicy(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -100,6 +104,7 @@ func TestCommandSide_AddDomainPolicy(t *testing.T) {
|
|||||||
orgID: "org1",
|
orgID: "org1",
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -109,6 +114,7 @@ func TestCommandSide_AddDomainPolicy(t *testing.T) {
|
|||||||
ResourceOwner: "org1",
|
ResourceOwner: "org1",
|
||||||
},
|
},
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -162,6 +168,7 @@ func TestCommandSide_ChangeDomainPolicy(t *testing.T) {
|
|||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -181,6 +188,7 @@ func TestCommandSide_ChangeDomainPolicy(t *testing.T) {
|
|||||||
orgID: "org1",
|
orgID: "org1",
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -197,6 +205,7 @@ func TestCommandSide_ChangeDomainPolicy(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -207,6 +216,7 @@ func TestCommandSide_ChangeDomainPolicy(t *testing.T) {
|
|||||||
orgID: "org1",
|
orgID: "org1",
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -223,13 +233,14 @@ func TestCommandSide_ChangeDomainPolicy(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
expectPush(
|
expectPush(
|
||||||
[]*repository.Event{
|
[]*repository.Event{
|
||||||
eventFromEventPusher(
|
eventFromEventPusher(
|
||||||
newDomainPolicyChangedEvent(context.Background(), "org1", false),
|
newDomainPolicyChangedEvent(context.Background(), "org1", false, false),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -240,6 +251,7 @@ func TestCommandSide_ChangeDomainPolicy(t *testing.T) {
|
|||||||
orgID: "org1",
|
orgID: "org1",
|
||||||
policy: &domain.DomainPolicy{
|
policy: &domain.DomainPolicy{
|
||||||
UserLoginMustBeDomain: false,
|
UserLoginMustBeDomain: false,
|
||||||
|
ValidateOrgDomains: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
@ -249,6 +261,7 @@ func TestCommandSide_ChangeDomainPolicy(t *testing.T) {
|
|||||||
ResourceOwner: "org1",
|
ResourceOwner: "org1",
|
||||||
},
|
},
|
||||||
UserLoginMustBeDomain: false,
|
UserLoginMustBeDomain: false,
|
||||||
|
ValidateOrgDomains: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -330,6 +343,7 @@ func TestCommandSide_RemoveDomainPolicy(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -370,11 +384,12 @@ func TestCommandSide_RemoveDomainPolicy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDomainPolicyChangedEvent(ctx context.Context, orgID string, userLoginMustBeDomain bool) *org.DomainPolicyChangedEvent {
|
func newDomainPolicyChangedEvent(ctx context.Context, orgID string, userLoginMustBeDomain, validateOrgDomains bool) *org.DomainPolicyChangedEvent {
|
||||||
event, _ := org.NewDomainPolicyChangedEvent(ctx,
|
event, _ := org.NewDomainPolicyChangedEvent(ctx,
|
||||||
&org.NewAggregate(orgID, orgID).Aggregate,
|
&org.NewAggregate(orgID, orgID).Aggregate,
|
||||||
[]policy.OrgPolicyChanges{
|
[]policy.DomainPolicyChanges{
|
||||||
policy.ChangeUserLoginMustBeDomain(userLoginMustBeDomain),
|
policy.ChangeUserLoginMustBeDomain(userLoginMustBeDomain),
|
||||||
|
policy.ChangeValidateOrgDomains(validateOrgDomains),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return event
|
return event
|
||||||
|
@ -10,6 +10,7 @@ type PolicyDomainWriteModel struct {
|
|||||||
eventstore.WriteModel
|
eventstore.WriteModel
|
||||||
|
|
||||||
UserLoginMustBeDomain bool
|
UserLoginMustBeDomain bool
|
||||||
|
ValidateOrgDomains bool
|
||||||
State domain.PolicyState
|
State domain.PolicyState
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,11 +19,15 @@ func (wm *PolicyDomainWriteModel) Reduce() error {
|
|||||||
switch e := event.(type) {
|
switch e := event.(type) {
|
||||||
case *policy.DomainPolicyAddedEvent:
|
case *policy.DomainPolicyAddedEvent:
|
||||||
wm.UserLoginMustBeDomain = e.UserLoginMustBeDomain
|
wm.UserLoginMustBeDomain = e.UserLoginMustBeDomain
|
||||||
|
wm.ValidateOrgDomains = e.ValidateOrgDomains
|
||||||
wm.State = domain.PolicyStateActive
|
wm.State = domain.PolicyStateActive
|
||||||
case *policy.DomainPolicyChangedEvent:
|
case *policy.DomainPolicyChangedEvent:
|
||||||
if e.UserLoginMustBeDomain != nil {
|
if e.UserLoginMustBeDomain != nil {
|
||||||
wm.UserLoginMustBeDomain = *e.UserLoginMustBeDomain
|
wm.UserLoginMustBeDomain = *e.UserLoginMustBeDomain
|
||||||
}
|
}
|
||||||
|
if e.ValidateOrgDomains != nil {
|
||||||
|
wm.ValidateOrgDomains = *e.ValidateOrgDomains
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return wm.WriteModel.Reduce()
|
return wm.WriteModel.Reduce()
|
||||||
|
@ -53,6 +53,7 @@ func Test_customDomainPolicy(t *testing.T) {
|
|||||||
context.Background(),
|
context.Background(),
|
||||||
&org.NewAggregate("id", "ro").Aggregate,
|
&org.NewAggregate("id", "ro").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@ -64,6 +65,7 @@ func Test_customDomainPolicy(t *testing.T) {
|
|||||||
Events: []eventstore.Event{},
|
Events: []eventstore.Event{},
|
||||||
},
|
},
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
State: domain.PolicyStateActive,
|
State: domain.PolicyStateActive,
|
||||||
},
|
},
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
@ -122,6 +124,7 @@ func Test_defaultDomainPolicy(t *testing.T) {
|
|||||||
context.Background(),
|
context.Background(),
|
||||||
&instance.NewAggregate("INSTANCE").Aggregate,
|
&instance.NewAggregate("INSTANCE").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@ -133,6 +136,7 @@ func Test_defaultDomainPolicy(t *testing.T) {
|
|||||||
Events: []eventstore.Event{},
|
Events: []eventstore.Event{},
|
||||||
},
|
},
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
State: domain.PolicyStateActive,
|
State: domain.PolicyStateActive,
|
||||||
},
|
},
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
@ -181,6 +185,7 @@ func Test_DomainPolicy(t *testing.T) {
|
|||||||
context.Background(),
|
context.Background(),
|
||||||
&org.NewAggregate("id", "ro").Aggregate,
|
&org.NewAggregate("id", "ro").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@ -192,6 +197,7 @@ func Test_DomainPolicy(t *testing.T) {
|
|||||||
Events: []eventstore.Event{},
|
Events: []eventstore.Event{},
|
||||||
},
|
},
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
State: domain.PolicyStateActive,
|
State: domain.PolicyStateActive,
|
||||||
},
|
},
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
@ -224,6 +230,7 @@ func Test_DomainPolicy(t *testing.T) {
|
|||||||
context.Background(),
|
context.Background(),
|
||||||
&instance.NewAggregate("INSTANCE").Aggregate,
|
&instance.NewAggregate("INSTANCE").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
}).
|
}).
|
||||||
@ -236,6 +243,7 @@ func Test_DomainPolicy(t *testing.T) {
|
|||||||
Events: []eventstore.Event{},
|
Events: []eventstore.Event{},
|
||||||
},
|
},
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
State: domain.PolicyStateActive,
|
State: domain.PolicyStateActive,
|
||||||
},
|
},
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
|
@ -179,6 +179,7 @@ func TestCommandSide_AddHumanOTP(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -112,6 +112,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&userAgg.Aggregate,
|
&userAgg.Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -167,6 +168,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&userAgg.Aggregate,
|
&userAgg.Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -282,6 +284,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -398,6 +401,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&userAgg.Aggregate,
|
&userAgg.Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -493,6 +497,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&userAgg.Aggregate,
|
&userAgg.Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -575,6 +580,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&userAgg.Aggregate,
|
&userAgg.Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -793,6 +799,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -828,6 +835,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -869,6 +877,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -957,6 +966,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1039,6 +1049,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1143,6 +1154,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1251,6 +1263,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1355,6 +1368,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1556,6 +1570,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1594,6 +1609,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1640,6 +1656,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1702,6 +1719,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1764,6 +1782,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
false,
|
false,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1843,6 +1862,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
false,
|
false,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1980,6 +2000,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2085,6 +2106,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("org1", "org1").Aggregate,
|
&user.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2184,6 +2206,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2305,6 +2328,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&org.NewAggregate("org1", "org1").Aggregate,
|
&org.NewAggregate("org1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2875,6 +2899,7 @@ func TestAddHumanCommand(t *testing.T) {
|
|||||||
context.Background(),
|
context.Background(),
|
||||||
&org.NewAggregate("id", "ro").Aggregate,
|
&org.NewAggregate("id", "ro").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
}).
|
}).
|
||||||
@ -2917,6 +2942,7 @@ func TestAddHumanCommand(t *testing.T) {
|
|||||||
context.Background(),
|
context.Background(),
|
||||||
&org.NewAggregate("id", "ro").Aggregate,
|
&org.NewAggregate("id", "ro").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
}, nil
|
}, nil
|
||||||
}).
|
}).
|
||||||
|
@ -86,6 +86,7 @@ func TestCommandSide_AddMachine(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
false,
|
false,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -113,6 +114,7 @@ func TestCommandSide_AddMachine(t *testing.T) {
|
|||||||
org.NewDomainPolicyAddedEvent(context.Background(),
|
org.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -207,6 +207,7 @@ func TestCommandSide_UsernameChange(t *testing.T) {
|
|||||||
instance.NewDomainPolicyAddedEvent(context.Background(),
|
instance.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -249,6 +250,7 @@ func TestCommandSide_UsernameChange(t *testing.T) {
|
|||||||
instance.NewDomainPolicyAddedEvent(context.Background(),
|
instance.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1032,6 +1034,7 @@ func TestCommandSide_RemoveUser(t *testing.T) {
|
|||||||
instance.NewDomainPolicyAddedEvent(context.Background(),
|
instance.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1096,6 +1099,7 @@ func TestCommandSide_RemoveUser(t *testing.T) {
|
|||||||
instance.NewDomainPolicyAddedEvent(context.Background(),
|
instance.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1153,6 +1157,7 @@ func TestCommandSide_RemoveUser(t *testing.T) {
|
|||||||
instance.NewDomainPolicyAddedEvent(context.Background(),
|
instance.NewDomainPolicyAddedEvent(context.Background(),
|
||||||
&user.NewAggregate("user1", "org1").Aggregate,
|
&user.NewAggregate("user1", "org1").Aggregate,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -8,5 +8,6 @@ type DomainPolicy struct {
|
|||||||
models.ObjectRoot
|
models.ObjectRoot
|
||||||
|
|
||||||
UserLoginMustBeDomain bool
|
UserLoginMustBeDomain bool
|
||||||
|
ValidateOrgDomains bool
|
||||||
Default bool
|
Default bool
|
||||||
}
|
}
|
@ -24,6 +24,7 @@ type DomainPolicy struct {
|
|||||||
State domain.PolicyState
|
State domain.PolicyState
|
||||||
|
|
||||||
UserLoginMustBeDomain bool
|
UserLoginMustBeDomain bool
|
||||||
|
ValidateOrgDomains bool
|
||||||
|
|
||||||
IsDefault bool
|
IsDefault bool
|
||||||
}
|
}
|
||||||
@ -60,6 +61,10 @@ var (
|
|||||||
name: projection.DomainPolicyUserLoginMustBeDomainCol,
|
name: projection.DomainPolicyUserLoginMustBeDomainCol,
|
||||||
table: domainPolicyTable,
|
table: domainPolicyTable,
|
||||||
}
|
}
|
||||||
|
DomainPolicyColValidateOrgDomains = Column{
|
||||||
|
name: projection.DomainPolicyValidateOrgDomainsCol,
|
||||||
|
table: domainPolicyTable,
|
||||||
|
}
|
||||||
DomainPolicyColIsDefault = Column{
|
DomainPolicyColIsDefault = Column{
|
||||||
name: projection.DomainPolicyIsDefaultCol,
|
name: projection.DomainPolicyIsDefaultCol,
|
||||||
table: domainPolicyTable,
|
table: domainPolicyTable,
|
||||||
@ -120,6 +125,7 @@ func prepareDomainPolicyQuery() (sq.SelectBuilder, func(*sql.Row) (*DomainPolicy
|
|||||||
DomainPolicyColChangeDate.identifier(),
|
DomainPolicyColChangeDate.identifier(),
|
||||||
DomainPolicyColResourceOwner.identifier(),
|
DomainPolicyColResourceOwner.identifier(),
|
||||||
DomainPolicyColUserLoginMustBeDomain.identifier(),
|
DomainPolicyColUserLoginMustBeDomain.identifier(),
|
||||||
|
DomainPolicyColValidateOrgDomains.identifier(),
|
||||||
DomainPolicyColIsDefault.identifier(),
|
DomainPolicyColIsDefault.identifier(),
|
||||||
DomainPolicyColState.identifier(),
|
DomainPolicyColState.identifier(),
|
||||||
).
|
).
|
||||||
@ -133,6 +139,7 @@ func prepareDomainPolicyQuery() (sq.SelectBuilder, func(*sql.Row) (*DomainPolicy
|
|||||||
&policy.ChangeDate,
|
&policy.ChangeDate,
|
||||||
&policy.ResourceOwner,
|
&policy.ResourceOwner,
|
||||||
&policy.UserLoginMustBeDomain,
|
&policy.UserLoginMustBeDomain,
|
||||||
|
&policy.ValidateOrgDomains,
|
||||||
&policy.IsDefault,
|
&policy.IsDefault,
|
||||||
&policy.State,
|
&policy.State,
|
||||||
)
|
)
|
||||||
|
@ -34,6 +34,7 @@ func Test_DomainPolicyPrepares(t *testing.T) {
|
|||||||
` projections.domain_policies.change_date,`+
|
` projections.domain_policies.change_date,`+
|
||||||
` projections.domain_policies.resource_owner,`+
|
` projections.domain_policies.resource_owner,`+
|
||||||
` projections.domain_policies.user_login_must_be_domain,`+
|
` projections.domain_policies.user_login_must_be_domain,`+
|
||||||
|
` projections.domain_policies.validate_org_domains,`+
|
||||||
` projections.domain_policies.is_default,`+
|
` projections.domain_policies.is_default,`+
|
||||||
` projections.domain_policies.state`+
|
` projections.domain_policies.state`+
|
||||||
` FROM projections.domain_policies`),
|
` FROM projections.domain_policies`),
|
||||||
@ -60,6 +61,7 @@ func Test_DomainPolicyPrepares(t *testing.T) {
|
|||||||
` projections.domain_policies.change_date,`+
|
` projections.domain_policies.change_date,`+
|
||||||
` projections.domain_policies.resource_owner,`+
|
` projections.domain_policies.resource_owner,`+
|
||||||
` projections.domain_policies.user_login_must_be_domain,`+
|
` projections.domain_policies.user_login_must_be_domain,`+
|
||||||
|
` projections.domain_policies.validate_org_domains,`+
|
||||||
` projections.domain_policies.is_default,`+
|
` projections.domain_policies.is_default,`+
|
||||||
` projections.domain_policies.state`+
|
` projections.domain_policies.state`+
|
||||||
` FROM projections.domain_policies`),
|
` FROM projections.domain_policies`),
|
||||||
@ -70,6 +72,7 @@ func Test_DomainPolicyPrepares(t *testing.T) {
|
|||||||
"change_date",
|
"change_date",
|
||||||
"resource_owner",
|
"resource_owner",
|
||||||
"user_login_must_be_domain",
|
"user_login_must_be_domain",
|
||||||
|
"validate_org_domains",
|
||||||
"is_default",
|
"is_default",
|
||||||
"state",
|
"state",
|
||||||
},
|
},
|
||||||
@ -81,6 +84,7 @@ func Test_DomainPolicyPrepares(t *testing.T) {
|
|||||||
"ro",
|
"ro",
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
domain.PolicyStateActive,
|
domain.PolicyStateActive,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -93,6 +97,7 @@ func Test_DomainPolicyPrepares(t *testing.T) {
|
|||||||
ResourceOwner: "ro",
|
ResourceOwner: "ro",
|
||||||
State: domain.PolicyStateActive,
|
State: domain.PolicyStateActive,
|
||||||
UserLoginMustBeDomain: true,
|
UserLoginMustBeDomain: true,
|
||||||
|
ValidateOrgDomains: true,
|
||||||
IsDefault: true,
|
IsDefault: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -107,6 +112,7 @@ func Test_DomainPolicyPrepares(t *testing.T) {
|
|||||||
` projections.domain_policies.change_date,`+
|
` projections.domain_policies.change_date,`+
|
||||||
` projections.domain_policies.resource_owner,`+
|
` projections.domain_policies.resource_owner,`+
|
||||||
` projections.domain_policies.user_login_must_be_domain,`+
|
` projections.domain_policies.user_login_must_be_domain,`+
|
||||||
|
` projections.domain_policies.validate_org_domains,`+
|
||||||
` projections.domain_policies.is_default,`+
|
` projections.domain_policies.is_default,`+
|
||||||
` projections.domain_policies.state`+
|
` projections.domain_policies.state`+
|
||||||
` FROM projections.domain_policies`),
|
` FROM projections.domain_policies`),
|
||||||
|
@ -22,6 +22,7 @@ const (
|
|||||||
DomainPolicySequenceCol = "sequence"
|
DomainPolicySequenceCol = "sequence"
|
||||||
DomainPolicyStateCol = "state"
|
DomainPolicyStateCol = "state"
|
||||||
DomainPolicyUserLoginMustBeDomainCol = "user_login_must_be_domain"
|
DomainPolicyUserLoginMustBeDomainCol = "user_login_must_be_domain"
|
||||||
|
DomainPolicyValidateOrgDomainsCol = "validate_org_domains"
|
||||||
DomainPolicyIsDefaultCol = "is_default"
|
DomainPolicyIsDefaultCol = "is_default"
|
||||||
DomainPolicyResourceOwnerCol = "resource_owner"
|
DomainPolicyResourceOwnerCol = "resource_owner"
|
||||||
DomainPolicyInstanceIDCol = "instance_id"
|
DomainPolicyInstanceIDCol = "instance_id"
|
||||||
@ -43,6 +44,7 @@ func NewDomainPolicyProjection(ctx context.Context, config crdb.StatementHandler
|
|||||||
crdb.NewColumn(DomainPolicySequenceCol, crdb.ColumnTypeInt64),
|
crdb.NewColumn(DomainPolicySequenceCol, crdb.ColumnTypeInt64),
|
||||||
crdb.NewColumn(DomainPolicyStateCol, crdb.ColumnTypeEnum),
|
crdb.NewColumn(DomainPolicyStateCol, crdb.ColumnTypeEnum),
|
||||||
crdb.NewColumn(DomainPolicyUserLoginMustBeDomainCol, crdb.ColumnTypeBool),
|
crdb.NewColumn(DomainPolicyUserLoginMustBeDomainCol, crdb.ColumnTypeBool),
|
||||||
|
crdb.NewColumn(DomainPolicyValidateOrgDomainsCol, crdb.ColumnTypeBool),
|
||||||
crdb.NewColumn(DomainPolicyIsDefaultCol, crdb.ColumnTypeBool, crdb.Default(false)),
|
crdb.NewColumn(DomainPolicyIsDefaultCol, crdb.ColumnTypeBool, crdb.Default(false)),
|
||||||
crdb.NewColumn(DomainPolicyResourceOwnerCol, crdb.ColumnTypeText),
|
crdb.NewColumn(DomainPolicyResourceOwnerCol, crdb.ColumnTypeText),
|
||||||
crdb.NewColumn(DomainPolicyInstanceIDCol, crdb.ColumnTypeText),
|
crdb.NewColumn(DomainPolicyInstanceIDCol, crdb.ColumnTypeText),
|
||||||
@ -111,6 +113,7 @@ func (p *DomainPolicyProjection) reduceAdded(event eventstore.Event) (*handler.S
|
|||||||
handler.NewCol(DomainPolicyIDCol, policyEvent.Aggregate().ID),
|
handler.NewCol(DomainPolicyIDCol, policyEvent.Aggregate().ID),
|
||||||
handler.NewCol(DomainPolicyStateCol, domain.PolicyStateActive),
|
handler.NewCol(DomainPolicyStateCol, domain.PolicyStateActive),
|
||||||
handler.NewCol(DomainPolicyUserLoginMustBeDomainCol, policyEvent.UserLoginMustBeDomain),
|
handler.NewCol(DomainPolicyUserLoginMustBeDomainCol, policyEvent.UserLoginMustBeDomain),
|
||||||
|
handler.NewCol(DomainPolicyValidateOrgDomainsCol, policyEvent.ValidateOrgDomains),
|
||||||
handler.NewCol(DomainPolicyIsDefaultCol, isDefault),
|
handler.NewCol(DomainPolicyIsDefaultCol, isDefault),
|
||||||
handler.NewCol(DomainPolicyResourceOwnerCol, policyEvent.Aggregate().ResourceOwner),
|
handler.NewCol(DomainPolicyResourceOwnerCol, policyEvent.Aggregate().ResourceOwner),
|
||||||
handler.NewCol(DomainPolicyInstanceIDCol, policyEvent.Aggregate().InstanceID),
|
handler.NewCol(DomainPolicyInstanceIDCol, policyEvent.Aggregate().InstanceID),
|
||||||
@ -134,6 +137,9 @@ func (p *DomainPolicyProjection) reduceChanged(event eventstore.Event) (*handler
|
|||||||
if policyEvent.UserLoginMustBeDomain != nil {
|
if policyEvent.UserLoginMustBeDomain != nil {
|
||||||
cols = append(cols, handler.NewCol(DomainPolicyUserLoginMustBeDomainCol, *policyEvent.UserLoginMustBeDomain))
|
cols = append(cols, handler.NewCol(DomainPolicyUserLoginMustBeDomainCol, *policyEvent.UserLoginMustBeDomain))
|
||||||
}
|
}
|
||||||
|
if policyEvent.ValidateOrgDomains != nil {
|
||||||
|
cols = append(cols, handler.NewCol(DomainPolicyValidateOrgDomainsCol, *policyEvent.ValidateOrgDomains))
|
||||||
|
}
|
||||||
return crdb.NewUpdateStatement(
|
return crdb.NewUpdateStatement(
|
||||||
&policyEvent,
|
&policyEvent,
|
||||||
cols,
|
cols,
|
||||||
|
@ -29,7 +29,8 @@ func TestDomainPolicyProjection_reduces(t *testing.T) {
|
|||||||
repository.EventType(org.DomainPolicyAddedEventType),
|
repository.EventType(org.DomainPolicyAddedEventType),
|
||||||
org.AggregateType,
|
org.AggregateType,
|
||||||
[]byte(`{
|
[]byte(`{
|
||||||
"userLoginMustBeDomain": true
|
"userLoginMustBeDomain": true,
|
||||||
|
"validateOrgDomains": true
|
||||||
}`),
|
}`),
|
||||||
), org.DomainPolicyAddedEventMapper),
|
), org.DomainPolicyAddedEventMapper),
|
||||||
},
|
},
|
||||||
@ -42,7 +43,7 @@ func TestDomainPolicyProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.domain_policies (creation_date, change_date, sequence, id, state, user_login_must_be_domain, is_default, resource_owner, instance_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.domain_policies (creation_date, change_date, sequence, id, state, user_login_must_be_domain, validate_org_domains, is_default, resource_owner, instance_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -50,6 +51,7 @@ func TestDomainPolicyProjection_reduces(t *testing.T) {
|
|||||||
"agg-id",
|
"agg-id",
|
||||||
domain.PolicyStateActive,
|
domain.PolicyStateActive,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
false,
|
false,
|
||||||
"ro-id",
|
"ro-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -67,7 +69,8 @@ func TestDomainPolicyProjection_reduces(t *testing.T) {
|
|||||||
repository.EventType(org.DomainPolicyChangedEventType),
|
repository.EventType(org.DomainPolicyChangedEventType),
|
||||||
org.AggregateType,
|
org.AggregateType,
|
||||||
[]byte(`{
|
[]byte(`{
|
||||||
"userLoginMustBeDomain": true
|
"userLoginMustBeDomain": true,
|
||||||
|
"validateOrgDomains": true
|
||||||
}`),
|
}`),
|
||||||
), org.DomainPolicyChangedEventMapper),
|
), org.DomainPolicyChangedEventMapper),
|
||||||
},
|
},
|
||||||
@ -79,11 +82,12 @@ func TestDomainPolicyProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.domain_policies SET (change_date, sequence, user_login_must_be_domain) = ($1, $2, $3) WHERE (id = $4)",
|
expectedStmt: "UPDATE projections.domain_policies SET (change_date, sequence, user_login_must_be_domain, validate_org_domains) = ($1, $2, $3, $4) WHERE (id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -126,7 +130,8 @@ func TestDomainPolicyProjection_reduces(t *testing.T) {
|
|||||||
repository.EventType(instance.DomainPolicyAddedEventType),
|
repository.EventType(instance.DomainPolicyAddedEventType),
|
||||||
instance.AggregateType,
|
instance.AggregateType,
|
||||||
[]byte(`{
|
[]byte(`{
|
||||||
"userLoginMustBeDomain": true
|
"userLoginMustBeDomain": true,
|
||||||
|
"validateOrgDomains": true
|
||||||
}`),
|
}`),
|
||||||
), instance.DomainPolicyAddedEventMapper),
|
), instance.DomainPolicyAddedEventMapper),
|
||||||
},
|
},
|
||||||
@ -138,7 +143,7 @@ func TestDomainPolicyProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.domain_policies (creation_date, change_date, sequence, id, state, user_login_must_be_domain, is_default, resource_owner, instance_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.domain_policies (creation_date, change_date, sequence, id, state, user_login_must_be_domain, validate_org_domains, is_default, resource_owner, instance_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -147,6 +152,7 @@ func TestDomainPolicyProjection_reduces(t *testing.T) {
|
|||||||
domain.PolicyStateActive,
|
domain.PolicyStateActive,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
"ro-id",
|
"ro-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
},
|
},
|
||||||
@ -163,7 +169,8 @@ func TestDomainPolicyProjection_reduces(t *testing.T) {
|
|||||||
repository.EventType(instance.DomainPolicyChangedEventType),
|
repository.EventType(instance.DomainPolicyChangedEventType),
|
||||||
instance.AggregateType,
|
instance.AggregateType,
|
||||||
[]byte(`{
|
[]byte(`{
|
||||||
"userLoginMustBeDomain": true
|
"userLoginMustBeDomain": true,
|
||||||
|
"validateOrgDomains": true
|
||||||
}`),
|
}`),
|
||||||
), instance.DomainPolicyChangedEventMapper),
|
), instance.DomainPolicyChangedEventMapper),
|
||||||
},
|
},
|
||||||
@ -175,11 +182,12 @@ func TestDomainPolicyProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.domain_policies SET (change_date, sequence, user_login_must_be_domain) = ($1, $2, $3) WHERE (id = $4)",
|
expectedStmt: "UPDATE projections.domain_policies SET (change_date, sequence, user_login_must_be_domain, validate_org_domains) = ($1, $2, $3, $4) WHERE (id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,8 @@ type DomainPolicyAddedEvent struct {
|
|||||||
func NewDomainPolicyAddedEvent(
|
func NewDomainPolicyAddedEvent(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
aggregate *eventstore.Aggregate,
|
aggregate *eventstore.Aggregate,
|
||||||
userLoginMustBeDomain bool,
|
userLoginMustBeDomain,
|
||||||
|
validateOrgDomain bool,
|
||||||
) *DomainPolicyAddedEvent {
|
) *DomainPolicyAddedEvent {
|
||||||
return &DomainPolicyAddedEvent{
|
return &DomainPolicyAddedEvent{
|
||||||
DomainPolicyAddedEvent: *policy.NewDomainPolicyAddedEvent(
|
DomainPolicyAddedEvent: *policy.NewDomainPolicyAddedEvent(
|
||||||
@ -30,6 +31,7 @@ func NewDomainPolicyAddedEvent(
|
|||||||
aggregate,
|
aggregate,
|
||||||
DomainPolicyAddedEventType),
|
DomainPolicyAddedEventType),
|
||||||
userLoginMustBeDomain,
|
userLoginMustBeDomain,
|
||||||
|
validateOrgDomain,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,7 +52,7 @@ type DomainPolicyChangedEvent struct {
|
|||||||
func NewDomainPolicyChangedEvent(
|
func NewDomainPolicyChangedEvent(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
aggregate *eventstore.Aggregate,
|
aggregate *eventstore.Aggregate,
|
||||||
changes []policy.OrgPolicyChanges,
|
changes []policy.DomainPolicyChanges,
|
||||||
) (*DomainPolicyChangedEvent, error) {
|
) (*DomainPolicyChangedEvent, error) {
|
||||||
changedEvent, err := policy.NewDomainPolicyChangedEvent(
|
changedEvent, err := policy.NewDomainPolicyChangedEvent(
|
||||||
eventstore.NewBaseEventForPush(
|
eventstore.NewBaseEventForPush(
|
||||||
|
@ -22,7 +22,8 @@ type DomainPolicyAddedEvent struct {
|
|||||||
func NewDomainPolicyAddedEvent(
|
func NewDomainPolicyAddedEvent(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
aggregate *eventstore.Aggregate,
|
aggregate *eventstore.Aggregate,
|
||||||
userLoginMustBeDomain bool,
|
userLoginMustBeDomain,
|
||||||
|
validateOrgDomains bool,
|
||||||
) *DomainPolicyAddedEvent {
|
) *DomainPolicyAddedEvent {
|
||||||
return &DomainPolicyAddedEvent{
|
return &DomainPolicyAddedEvent{
|
||||||
DomainPolicyAddedEvent: *policy.NewDomainPolicyAddedEvent(
|
DomainPolicyAddedEvent: *policy.NewDomainPolicyAddedEvent(
|
||||||
@ -31,6 +32,7 @@ func NewDomainPolicyAddedEvent(
|
|||||||
aggregate,
|
aggregate,
|
||||||
DomainPolicyAddedEventType),
|
DomainPolicyAddedEventType),
|
||||||
userLoginMustBeDomain,
|
userLoginMustBeDomain,
|
||||||
|
validateOrgDomains,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -51,7 +53,7 @@ type DomainPolicyChangedEvent struct {
|
|||||||
func NewDomainPolicyChangedEvent(
|
func NewDomainPolicyChangedEvent(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
aggregate *eventstore.Aggregate,
|
aggregate *eventstore.Aggregate,
|
||||||
changes []policy.OrgPolicyChanges,
|
changes []policy.DomainPolicyChanges,
|
||||||
) (*DomainPolicyChangedEvent, error) {
|
) (*DomainPolicyChangedEvent, error) {
|
||||||
changedEvent, err := policy.NewDomainPolicyChangedEvent(
|
changedEvent, err := policy.NewDomainPolicyChangedEvent(
|
||||||
eventstore.NewBaseEventForPush(
|
eventstore.NewBaseEventForPush(
|
||||||
|
@ -20,6 +20,7 @@ type DomainPolicyAddedEvent struct {
|
|||||||
eventstore.BaseEvent `json:"-"`
|
eventstore.BaseEvent `json:"-"`
|
||||||
|
|
||||||
UserLoginMustBeDomain bool `json:"userLoginMustBeDomain,omitempty"`
|
UserLoginMustBeDomain bool `json:"userLoginMustBeDomain,omitempty"`
|
||||||
|
ValidateOrgDomains bool `json:"validateOrgDomains,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *DomainPolicyAddedEvent) Data() interface{} {
|
func (e *DomainPolicyAddedEvent) Data() interface{} {
|
||||||
@ -32,12 +33,14 @@ func (e *DomainPolicyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCo
|
|||||||
|
|
||||||
func NewDomainPolicyAddedEvent(
|
func NewDomainPolicyAddedEvent(
|
||||||
base *eventstore.BaseEvent,
|
base *eventstore.BaseEvent,
|
||||||
userLoginMustBeDomain bool,
|
userLoginMustBeDomain,
|
||||||
|
validateOrgDomains bool,
|
||||||
) *DomainPolicyAddedEvent {
|
) *DomainPolicyAddedEvent {
|
||||||
|
|
||||||
return &DomainPolicyAddedEvent{
|
return &DomainPolicyAddedEvent{
|
||||||
BaseEvent: *base,
|
BaseEvent: *base,
|
||||||
UserLoginMustBeDomain: userLoginMustBeDomain,
|
UserLoginMustBeDomain: userLoginMustBeDomain,
|
||||||
|
ValidateOrgDomains: validateOrgDomains,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +61,7 @@ type DomainPolicyChangedEvent struct {
|
|||||||
eventstore.BaseEvent `json:"-"`
|
eventstore.BaseEvent `json:"-"`
|
||||||
|
|
||||||
UserLoginMustBeDomain *bool `json:"userLoginMustBeDomain,omitempty"`
|
UserLoginMustBeDomain *bool `json:"userLoginMustBeDomain,omitempty"`
|
||||||
|
ValidateOrgDomains *bool `json:"validateOrgDomains,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *DomainPolicyChangedEvent) Data() interface{} {
|
func (e *DomainPolicyChangedEvent) Data() interface{} {
|
||||||
@ -70,7 +74,7 @@ func (e *DomainPolicyChangedEvent) UniqueConstraints() []*eventstore.EventUnique
|
|||||||
|
|
||||||
func NewDomainPolicyChangedEvent(
|
func NewDomainPolicyChangedEvent(
|
||||||
base *eventstore.BaseEvent,
|
base *eventstore.BaseEvent,
|
||||||
changes []OrgPolicyChanges,
|
changes []DomainPolicyChanges,
|
||||||
) (*DomainPolicyChangedEvent, error) {
|
) (*DomainPolicyChangedEvent, error) {
|
||||||
if len(changes) == 0 {
|
if len(changes) == 0 {
|
||||||
return nil, errors.ThrowPreconditionFailed(nil, "POLICY-DAf3h", "Errors.NoChangesFound")
|
return nil, errors.ThrowPreconditionFailed(nil, "POLICY-DAf3h", "Errors.NoChangesFound")
|
||||||
@ -84,7 +88,7 @@ func NewDomainPolicyChangedEvent(
|
|||||||
return changeEvent, nil
|
return changeEvent, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrgPolicyChanges func(*DomainPolicyChangedEvent)
|
type DomainPolicyChanges func(*DomainPolicyChangedEvent)
|
||||||
|
|
||||||
func ChangeUserLoginMustBeDomain(userLoginMustBeDomain bool) func(*DomainPolicyChangedEvent) {
|
func ChangeUserLoginMustBeDomain(userLoginMustBeDomain bool) func(*DomainPolicyChangedEvent) {
|
||||||
return func(e *DomainPolicyChangedEvent) {
|
return func(e *DomainPolicyChangedEvent) {
|
||||||
@ -92,6 +96,12 @@ func ChangeUserLoginMustBeDomain(userLoginMustBeDomain bool) func(*DomainPolicyC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ChangeValidateOrgDomains(validateOrgDomain bool) func(*DomainPolicyChangedEvent) {
|
||||||
|
return func(e *DomainPolicyChangedEvent) {
|
||||||
|
e.ValidateOrgDomains = &validateOrgDomain
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func DomainPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
func DomainPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||||
e := &DomainPolicyChangedEvent{
|
e := &DomainPolicyChangedEvent{
|
||||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||||
|
@ -3589,6 +3589,7 @@ message GetDomainPolicyResponse {
|
|||||||
|
|
||||||
message UpdateDomainPolicyRequest {
|
message UpdateDomainPolicyRequest {
|
||||||
bool user_login_must_be_domain = 1;
|
bool user_login_must_be_domain = 1;
|
||||||
|
bool validate_org_domains = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UpdateDomainPolicyResponse {
|
message UpdateDomainPolicyResponse {
|
||||||
@ -3637,6 +3638,11 @@ message AddCustomDomainPolicyRequest {
|
|||||||
description: "the username has to end with the domain of it's organisation"
|
description: "the username has to end with the domain of it's organisation"
|
||||||
}
|
}
|
||||||
]; // the username has to end with the domain of it's organisation (uniqueness is organisation based)
|
]; // the username has to end with the domain of it's organisation (uniqueness is organisation based)
|
||||||
|
bool validate_org_domains = 3 [
|
||||||
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||||
|
description: "defines if organisation domains should be validated org count as validated automatically"
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddCustomDomainPolicyResponse {
|
message AddCustomDomainPolicyResponse {
|
||||||
@ -3663,6 +3669,11 @@ message UpdateCustomDomainPolicyRequest {
|
|||||||
description: "the username has to end with the domain of it's organisation"
|
description: "the username has to end with the domain of it's organisation"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
bool validate_org_domains = 3 [
|
||||||
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||||
|
description: "defines if organisation domains should be validated org count as validated automatically"
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
message UpdateCustomDomainPolicyResponse {
|
message UpdateCustomDomainPolicyResponse {
|
||||||
|
@ -35,6 +35,11 @@ message DomainPolicy {
|
|||||||
description: "defines if the organisation's admin changed the policy"
|
description: "defines if the organisation's admin changed the policy"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
bool validate_org_domains = 4 [
|
||||||
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||||
|
description: "defines if organisation domains should be validated org count as validated automatically"
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
message LabelPolicy {
|
message LabelPolicy {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user