mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:37:32 +00:00
fix: rename iam to instance (#3345)
* fix: rename iam command side to instance * fix: rename iam command side to instance * fix: rename iam command side to instance * fix: rename iam command side to instance * fix: rename orgiampolicy to domain policy * fix: merge conflicts * fix: protos * fix: md files * implement deprecated org iam policy again Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
package iam
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/repository"
|
||||
"github.com/caos/zitadel/internal/repository/policy"
|
||||
)
|
||||
|
||||
var (
|
||||
OrgIAMPolicyAddedEventType = iamEventTypePrefix + policy.OrgIAMPolicyAddedEventType
|
||||
OrgIAMPolicyChangedEventType = iamEventTypePrefix + policy.OrgIAMPolicyChangedEventType
|
||||
)
|
||||
|
||||
type OrgIAMPolicyAddedEvent struct {
|
||||
policy.OrgIAMPolicyAddedEvent
|
||||
}
|
||||
|
||||
func NewOrgIAMPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
userLoginMustBeDomain bool,
|
||||
) *OrgIAMPolicyAddedEvent {
|
||||
return &OrgIAMPolicyAddedEvent{
|
||||
OrgIAMPolicyAddedEvent: *policy.NewOrgIAMPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgIAMPolicyAddedEventType),
|
||||
userLoginMustBeDomain,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func OrgIAMPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := policy.OrgIAMPolicyAddedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OrgIAMPolicyAddedEvent{OrgIAMPolicyAddedEvent: *e.(*policy.OrgIAMPolicyAddedEvent)}, nil
|
||||
}
|
||||
|
||||
type OrgIAMPolicyChangedEvent struct {
|
||||
policy.OrgIAMPolicyChangedEvent
|
||||
}
|
||||
|
||||
func NewOrgIAMPolicyChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.OrgIAMPolicyChanges,
|
||||
) (*OrgIAMPolicyChangedEvent, error) {
|
||||
changedEvent, err := policy.NewOrgIAMPolicyChangedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgIAMPolicyChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &OrgIAMPolicyChangedEvent{OrgIAMPolicyChangedEvent: *changedEvent}, nil
|
||||
}
|
||||
|
||||
func OrgIAMPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := policy.OrgIAMPolicyChangedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OrgIAMPolicyChangedEvent{OrgIAMPolicyChangedEvent: *e.(*policy.OrgIAMPolicyChangedEvent)}, nil
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
iamEventTypePrefix = eventstore.EventType("iam.")
|
||||
instanceEventTypePrefix = eventstore.EventType("instance.")
|
||||
)
|
||||
|
||||
const (
|
||||
AggregateType = "iam"
|
||||
AggregateType = "instance"
|
||||
AggregateVersion = "v1"
|
||||
)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
CustomTextSetEventType = iamEventTypePrefix + policy.CustomTextSetEventType
|
||||
CustomTextRemovedEventType = iamEventTypePrefix + policy.CustomTextRemovedEventType
|
||||
CustomTextTemplateRemovedEventType = iamEventTypePrefix + policy.CustomTextTemplateRemovedEventType
|
||||
CustomTextSetEventType = instanceEventTypePrefix + policy.CustomTextSetEventType
|
||||
CustomTextRemovedEventType = instanceEventTypePrefix + policy.CustomTextRemovedEventType
|
||||
CustomTextTemplateRemovedEventType = instanceEventTypePrefix + policy.CustomTextTemplateRemovedEventType
|
||||
)
|
||||
|
||||
type CustomTextSetEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -14,9 +14,9 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
DebugNotificationProviderFileAddedEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + fileType + settings.DebugNotificationProviderAdded
|
||||
DebugNotificationProviderFileChangedEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + fileType + settings.DebugNotificationProviderChanged
|
||||
DebugNotificationProviderFileRemovedEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + fileType + settings.DebugNotificationProviderRemoved
|
||||
DebugNotificationProviderFileAddedEventType = instanceEventTypePrefix + settings.DebugNotificationPrefix + fileType + settings.DebugNotificationProviderAdded
|
||||
DebugNotificationProviderFileChangedEventType = instanceEventTypePrefix + settings.DebugNotificationPrefix + fileType + settings.DebugNotificationProviderChanged
|
||||
DebugNotificationProviderFileRemovedEventType = instanceEventTypePrefix + settings.DebugNotificationPrefix + fileType + settings.DebugNotificationProviderRemoved
|
||||
)
|
||||
|
||||
type DebugNotificationProviderFileAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -14,11 +14,11 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
DebugNotificationProviderLogAddedEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderAdded
|
||||
DebugNotificationProviderLogChangedEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderChanged
|
||||
DebugNotificationProviderLogEnabledEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderEnabled
|
||||
DebugNotificationProviderLogDisabledEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderDisabled
|
||||
DebugNotificationProviderLogRemovedEventType = iamEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderRemoved
|
||||
DebugNotificationProviderLogAddedEventType = instanceEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderAdded
|
||||
DebugNotificationProviderLogChangedEventType = instanceEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderChanged
|
||||
DebugNotificationProviderLogEnabledEventType = instanceEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderEnabled
|
||||
DebugNotificationProviderLogDisabledEventType = instanceEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderDisabled
|
||||
DebugNotificationProviderLogRemovedEventType = instanceEventTypePrefix + settings.DebugNotificationPrefix + logType + settings.DebugNotificationProviderRemoved
|
||||
)
|
||||
|
||||
type DebugNotificationProviderLogAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
@@ -47,8 +47,8 @@ func RegisterEventMappers(es *eventstore.Eventstore) {
|
||||
RegisterFilterEventMapper(LabelPolicyAssetsRemovedEventType, LabelPolicyAssetsRemovedEventMapper).
|
||||
RegisterFilterEventMapper(LoginPolicyAddedEventType, LoginPolicyAddedEventMapper).
|
||||
RegisterFilterEventMapper(LoginPolicyChangedEventType, LoginPolicyChangedEventMapper).
|
||||
RegisterFilterEventMapper(OrgIAMPolicyAddedEventType, OrgIAMPolicyAddedEventMapper).
|
||||
RegisterFilterEventMapper(OrgIAMPolicyChangedEventType, OrgIAMPolicyChangedEventMapper).
|
||||
RegisterFilterEventMapper(InstanceDomainPolicyAddedEventType, InstanceDomainPolicyAddedEventMapper).
|
||||
RegisterFilterEventMapper(InstanceDomainPolicyChangedEventType, InstanceDomainPolicyChangedEventMapper).
|
||||
RegisterFilterEventMapper(PasswordAgePolicyAddedEventType, PasswordAgePolicyAddedEventMapper).
|
||||
RegisterFilterEventMapper(PasswordAgePolicyChangedEventType, PasswordAgePolicyChangedEventMapper).
|
||||
RegisterFilterEventMapper(PasswordComplexityPolicyAddedEventType, PasswordComplexityPolicyAddedEventMapper).
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
FeaturesSetEventType = iamEventTypePrefix + features.FeaturesSetEventType
|
||||
FeaturesSetEventType = instanceEventTypePrefix + features.FeaturesSetEventType
|
||||
)
|
||||
|
||||
type FeaturesSetEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
MemberAddedEventType = iamEventTypePrefix + member.AddedEventType
|
||||
MemberChangedEventType = iamEventTypePrefix + member.ChangedEventType
|
||||
MemberRemovedEventType = iamEventTypePrefix + member.RemovedEventType
|
||||
MemberCascadeRemovedEventType = iamEventTypePrefix + member.CascadeRemovedEventType
|
||||
MemberAddedEventType = instanceEventTypePrefix + member.AddedEventType
|
||||
MemberChangedEventType = instanceEventTypePrefix + member.ChangedEventType
|
||||
MemberRemovedEventType = instanceEventTypePrefix + member.RemovedEventType
|
||||
MemberCascadeRemovedEventType = instanceEventTypePrefix + member.CascadeRemovedEventType
|
||||
)
|
||||
|
||||
type MemberAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
const (
|
||||
oidcSettingsPrefix = "oidc.settings."
|
||||
OIDCSettingsAddedEventType = iamEventTypePrefix + oidcSettingsPrefix + "added"
|
||||
OIDCSettingsChangedEventType = iamEventTypePrefix + oidcSettingsPrefix + "changed"
|
||||
OIDCSettingsRemovedEventType = iamEventTypePrefix + oidcSettingsPrefix + "removed"
|
||||
OIDCSettingsAddedEventType = instanceEventTypePrefix + oidcSettingsPrefix + "added"
|
||||
OIDCSettingsChangedEventType = instanceEventTypePrefix + oidcSettingsPrefix + "changed"
|
||||
OIDCSettingsRemovedEventType = instanceEventTypePrefix + oidcSettingsPrefix + "removed"
|
||||
)
|
||||
|
||||
type OIDCSettingsAddedEvent struct {
|
75
internal/repository/instance/policy_domain.go
Normal file
75
internal/repository/instance/policy_domain.go
Normal file
@@ -0,0 +1,75 @@
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/repository"
|
||||
"github.com/caos/zitadel/internal/repository/policy"
|
||||
)
|
||||
|
||||
var (
|
||||
InstanceDomainPolicyAddedEventType = instanceEventTypePrefix + policy.DomainPolicyAddedEventType
|
||||
InstanceDomainPolicyChangedEventType = instanceEventTypePrefix + policy.DomainPolicyChangedEventType
|
||||
)
|
||||
|
||||
type InstanceDomainPolicyAddedEvent struct {
|
||||
policy.DomainPolicyAddedEvent
|
||||
}
|
||||
|
||||
func NewInstnaceDomainPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
userLoginMustBeDomain bool,
|
||||
) *InstanceDomainPolicyAddedEvent {
|
||||
return &InstanceDomainPolicyAddedEvent{
|
||||
DomainPolicyAddedEvent: *policy.NewDomainPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
InstanceDomainPolicyAddedEventType),
|
||||
userLoginMustBeDomain,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func InstanceDomainPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := policy.DomainPolicyAddedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &InstanceDomainPolicyAddedEvent{DomainPolicyAddedEvent: *e.(*policy.DomainPolicyAddedEvent)}, nil
|
||||
}
|
||||
|
||||
type InstanceDomainPolicyChangedEvent struct {
|
||||
policy.DomainPolicyChangedEvent
|
||||
}
|
||||
|
||||
func NewInstanceDomainPolicyChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.OrgPolicyChanges,
|
||||
) (*InstanceDomainPolicyChangedEvent, error) {
|
||||
changedEvent, err := policy.NewDomainPolicyChangedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
InstanceDomainPolicyChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &InstanceDomainPolicyChangedEvent{DomainPolicyChangedEvent: *changedEvent}, nil
|
||||
}
|
||||
|
||||
func InstanceDomainPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := policy.DomainPolicyChangedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &InstanceDomainPolicyChangedEvent{DomainPolicyChangedEvent: *e.(*policy.DomainPolicyChangedEvent)}, nil
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -10,23 +10,23 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
LabelPolicyAddedEventType = iamEventTypePrefix + policy.LabelPolicyAddedEventType
|
||||
LabelPolicyChangedEventType = iamEventTypePrefix + policy.LabelPolicyChangedEventType
|
||||
LabelPolicyActivatedEventType = iamEventTypePrefix + policy.LabelPolicyActivatedEventType
|
||||
LabelPolicyAddedEventType = instanceEventTypePrefix + policy.LabelPolicyAddedEventType
|
||||
LabelPolicyChangedEventType = instanceEventTypePrefix + policy.LabelPolicyChangedEventType
|
||||
LabelPolicyActivatedEventType = instanceEventTypePrefix + policy.LabelPolicyActivatedEventType
|
||||
|
||||
LabelPolicyLogoAddedEventType = iamEventTypePrefix + policy.LabelPolicyLogoAddedEventType
|
||||
LabelPolicyLogoRemovedEventType = iamEventTypePrefix + policy.LabelPolicyLogoRemovedEventType
|
||||
LabelPolicyIconAddedEventType = iamEventTypePrefix + policy.LabelPolicyIconAddedEventType
|
||||
LabelPolicyIconRemovedEventType = iamEventTypePrefix + policy.LabelPolicyIconRemovedEventType
|
||||
LabelPolicyLogoDarkAddedEventType = iamEventTypePrefix + policy.LabelPolicyLogoDarkAddedEventType
|
||||
LabelPolicyLogoDarkRemovedEventType = iamEventTypePrefix + policy.LabelPolicyLogoDarkRemovedEventType
|
||||
LabelPolicyIconDarkAddedEventType = iamEventTypePrefix + policy.LabelPolicyIconDarkAddedEventType
|
||||
LabelPolicyIconDarkRemovedEventType = iamEventTypePrefix + policy.LabelPolicyIconDarkRemovedEventType
|
||||
LabelPolicyLogoAddedEventType = instanceEventTypePrefix + policy.LabelPolicyLogoAddedEventType
|
||||
LabelPolicyLogoRemovedEventType = instanceEventTypePrefix + policy.LabelPolicyLogoRemovedEventType
|
||||
LabelPolicyIconAddedEventType = instanceEventTypePrefix + policy.LabelPolicyIconAddedEventType
|
||||
LabelPolicyIconRemovedEventType = instanceEventTypePrefix + policy.LabelPolicyIconRemovedEventType
|
||||
LabelPolicyLogoDarkAddedEventType = instanceEventTypePrefix + policy.LabelPolicyLogoDarkAddedEventType
|
||||
LabelPolicyLogoDarkRemovedEventType = instanceEventTypePrefix + policy.LabelPolicyLogoDarkRemovedEventType
|
||||
LabelPolicyIconDarkAddedEventType = instanceEventTypePrefix + policy.LabelPolicyIconDarkAddedEventType
|
||||
LabelPolicyIconDarkRemovedEventType = instanceEventTypePrefix + policy.LabelPolicyIconDarkRemovedEventType
|
||||
|
||||
LabelPolicyFontAddedEventType = iamEventTypePrefix + policy.LabelPolicyFontAddedEventType
|
||||
LabelPolicyFontRemovedEventType = iamEventTypePrefix + policy.LabelPolicyFontRemovedEventType
|
||||
LabelPolicyFontAddedEventType = instanceEventTypePrefix + policy.LabelPolicyFontAddedEventType
|
||||
LabelPolicyFontRemovedEventType = instanceEventTypePrefix + policy.LabelPolicyFontRemovedEventType
|
||||
|
||||
LabelPolicyAssetsRemovedEventType = iamEventTypePrefix + policy.LabelPolicyAssetsRemovedEventType
|
||||
LabelPolicyAssetsRemovedEventType = instanceEventTypePrefix + policy.LabelPolicyAssetsRemovedEventType
|
||||
)
|
||||
|
||||
type LabelPolicyAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
LoginPolicyAddedEventType = iamEventTypePrefix + policy.LoginPolicyAddedEventType
|
||||
LoginPolicyChangedEventType = iamEventTypePrefix + policy.LoginPolicyChangedEventType
|
||||
LoginPolicyAddedEventType = instanceEventTypePrefix + policy.LoginPolicyAddedEventType
|
||||
LoginPolicyChangedEventType = instanceEventTypePrefix + policy.LoginPolicyChangedEventType
|
||||
)
|
||||
|
||||
type LoginPolicyAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
LoginPolicySecondFactorAddedEventType = iamEventTypePrefix + policy.LoginPolicySecondFactorAddedEventType
|
||||
LoginPolicySecondFactorRemovedEventType = iamEventTypePrefix + policy.LoginPolicySecondFactorRemovedEventType
|
||||
LoginPolicySecondFactorAddedEventType = instanceEventTypePrefix + policy.LoginPolicySecondFactorAddedEventType
|
||||
LoginPolicySecondFactorRemovedEventType = instanceEventTypePrefix + policy.LoginPolicySecondFactorRemovedEventType
|
||||
|
||||
LoginPolicyMultiFactorAddedEventType = iamEventTypePrefix + policy.LoginPolicyMultiFactorAddedEventType
|
||||
LoginPolicyMultiFactorRemovedEventType = iamEventTypePrefix + policy.LoginPolicyMultiFactorRemovedEventType
|
||||
LoginPolicyMultiFactorAddedEventType = instanceEventTypePrefix + policy.LoginPolicyMultiFactorAddedEventType
|
||||
LoginPolicyMultiFactorRemovedEventType = instanceEventTypePrefix + policy.LoginPolicyMultiFactorRemovedEventType
|
||||
)
|
||||
|
||||
type LoginPolicySecondFactorAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
LoginPolicyIDPProviderAddedEventType = iamEventTypePrefix + policy.LoginPolicyIDPProviderAddedType
|
||||
LoginPolicyIDPProviderRemovedEventType = iamEventTypePrefix + policy.LoginPolicyIDPProviderRemovedType
|
||||
LoginPolicyIDPProviderCascadeRemovedEventType = iamEventTypePrefix + policy.LoginPolicyIDPProviderCascadeRemovedType
|
||||
LoginPolicyIDPProviderAddedEventType = instanceEventTypePrefix + policy.LoginPolicyIDPProviderAddedType
|
||||
LoginPolicyIDPProviderRemovedEventType = instanceEventTypePrefix + policy.LoginPolicyIDPProviderRemovedType
|
||||
LoginPolicyIDPProviderCascadeRemovedEventType = instanceEventTypePrefix + policy.LoginPolicyIDPProviderCascadeRemovedType
|
||||
)
|
||||
|
||||
type IdentityProviderAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
MailTemplateAddedEventType = iamEventTypePrefix + policy.MailTemplatePolicyAddedEventType
|
||||
MailTemplateChangedEventType = iamEventTypePrefix + policy.MailTemplatePolicyChangedEventType
|
||||
MailTemplateAddedEventType = instanceEventTypePrefix + policy.MailTemplatePolicyAddedEventType
|
||||
MailTemplateChangedEventType = instanceEventTypePrefix + policy.MailTemplatePolicyChangedEventType
|
||||
)
|
||||
|
||||
type MailTemplateAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
MailTextAddedEventType = iamEventTypePrefix + policy.MailTextPolicyAddedEventType
|
||||
MailTextChangedEventType = iamEventTypePrefix + policy.MailTextPolicyChangedEventType
|
||||
MailTextAddedEventType = instanceEventTypePrefix + policy.MailTextPolicyAddedEventType
|
||||
MailTextChangedEventType = instanceEventTypePrefix + policy.MailTextPolicyChangedEventType
|
||||
)
|
||||
|
||||
type MailTextAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
PasswordAgePolicyAddedEventType = iamEventTypePrefix + policy.PasswordAgePolicyAddedEventType
|
||||
PasswordAgePolicyChangedEventType = iamEventTypePrefix + policy.PasswordAgePolicyChangedEventType
|
||||
PasswordAgePolicyAddedEventType = instanceEventTypePrefix + policy.PasswordAgePolicyAddedEventType
|
||||
PasswordAgePolicyChangedEventType = instanceEventTypePrefix + policy.PasswordAgePolicyChangedEventType
|
||||
)
|
||||
|
||||
type PasswordAgePolicyAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
PasswordComplexityPolicyAddedEventType = iamEventTypePrefix + policy.PasswordComplexityPolicyAddedEventType
|
||||
PasswordComplexityPolicyChangedEventType = iamEventTypePrefix + policy.PasswordComplexityPolicyChangedEventType
|
||||
PasswordComplexityPolicyAddedEventType = instanceEventTypePrefix + policy.PasswordComplexityPolicyAddedEventType
|
||||
PasswordComplexityPolicyChangedEventType = instanceEventTypePrefix + policy.PasswordComplexityPolicyChangedEventType
|
||||
)
|
||||
|
||||
type PasswordComplexityPolicyAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
LockoutPolicyAddedEventType = iamEventTypePrefix + policy.LockoutPolicyAddedEventType
|
||||
LockoutPolicyChangedEventType = iamEventTypePrefix + policy.LockoutPolicyChangedEventType
|
||||
LockoutPolicyAddedEventType = instanceEventTypePrefix + policy.LockoutPolicyAddedEventType
|
||||
LockoutPolicyChangedEventType = instanceEventTypePrefix + policy.LockoutPolicyChangedEventType
|
||||
)
|
||||
|
||||
type LockoutPolicyAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
PrivacyPolicyAddedEventType = iamEventTypePrefix + policy.PrivacyPolicyAddedEventType
|
||||
PrivacyPolicyChangedEventType = iamEventTypePrefix + policy.PrivacyPolicyChangedEventType
|
||||
PrivacyPolicyAddedEventType = instanceEventTypePrefix + policy.PrivacyPolicyAddedEventType
|
||||
PrivacyPolicyChangedEventType = instanceEventTypePrefix + policy.PrivacyPolicyChangedEventType
|
||||
)
|
||||
|
||||
type PrivacyPolicyAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -14,9 +14,9 @@ import (
|
||||
const (
|
||||
UniqueSecretGeneratorType = "secret_generator"
|
||||
secretGeneratorPrefix = "secret.generator."
|
||||
SecretGeneratorAddedEventType = iamEventTypePrefix + secretGeneratorPrefix + "added"
|
||||
SecretGeneratorChangedEventType = iamEventTypePrefix + secretGeneratorPrefix + "changed"
|
||||
SecretGeneratorRemovedEventType = iamEventTypePrefix + secretGeneratorPrefix + "removed"
|
||||
SecretGeneratorAddedEventType = instanceEventTypePrefix + secretGeneratorPrefix + "added"
|
||||
SecretGeneratorChangedEventType = instanceEventTypePrefix + secretGeneratorPrefix + "changed"
|
||||
SecretGeneratorRemovedEventType = instanceEventTypePrefix + secretGeneratorPrefix + "removed"
|
||||
)
|
||||
|
||||
func NewAddSecretGeneratorTypeUniqueConstraint(generatorType domain.SecretGeneratorType) *eventstore.EventUniqueConstraint {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -13,12 +13,12 @@ import (
|
||||
const (
|
||||
smsConfigPrefix = "sms.config"
|
||||
smsConfigTwilioPrefix = "twilio."
|
||||
SMSConfigTwilioAddedEventType = iamEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "added"
|
||||
SMSConfigTwilioChangedEventType = iamEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "changed"
|
||||
SMSConfigTwilioTokenChangedEventType = iamEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "token.changed"
|
||||
SMSConfigActivatedEventType = iamEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "activated"
|
||||
SMSConfigDeactivatedEventType = iamEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "deactivated"
|
||||
SMSConfigRemovedEventType = iamEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "removed"
|
||||
SMSConfigTwilioAddedEventType = instanceEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "added"
|
||||
SMSConfigTwilioChangedEventType = instanceEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "changed"
|
||||
SMSConfigTwilioTokenChangedEventType = instanceEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "token.changed"
|
||||
SMSConfigActivatedEventType = instanceEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "activated"
|
||||
SMSConfigDeactivatedEventType = instanceEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "deactivated"
|
||||
SMSConfigRemovedEventType = instanceEventTypePrefix + smsConfigPrefix + smsConfigTwilioPrefix + "removed"
|
||||
)
|
||||
|
||||
type SMSConfigTwilioAddedEvent struct {
|
@@ -1,4 +1,4 @@
|
||||
package iam
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
const (
|
||||
smtpConfigPrefix = "smtp.config"
|
||||
SMTPConfigAddedEventType = iamEventTypePrefix + smtpConfigPrefix + "added"
|
||||
SMTPConfigChangedEventType = iamEventTypePrefix + smtpConfigPrefix + "changed"
|
||||
SMTPConfigPasswordChangedEventType = iamEventTypePrefix + smtpConfigPrefix + "password.changed"
|
||||
SMTPConfigAddedEventType = instanceEventTypePrefix + smtpConfigPrefix + "added"
|
||||
SMTPConfigChangedEventType = instanceEventTypePrefix + smtpConfigPrefix + "changed"
|
||||
SMTPConfigPasswordChangedEventType = instanceEventTypePrefix + smtpConfigPrefix + "password.changed"
|
||||
)
|
||||
|
||||
type SMTPConfigAddedEvent struct {
|
@@ -44,9 +44,9 @@ func RegisterEventMappers(es *eventstore.Eventstore) {
|
||||
RegisterFilterEventMapper(LoginPolicyIDPProviderAddedEventType, IdentityProviderAddedEventMapper).
|
||||
RegisterFilterEventMapper(LoginPolicyIDPProviderRemovedEventType, IdentityProviderRemovedEventMapper).
|
||||
RegisterFilterEventMapper(LoginPolicyIDPProviderCascadeRemovedEventType, IdentityProviderCascadeRemovedEventMapper).
|
||||
RegisterFilterEventMapper(OrgIAMPolicyAddedEventType, OrgIAMPolicyAddedEventMapper).
|
||||
RegisterFilterEventMapper(OrgIAMPolicyChangedEventType, OrgIAMPolicyChangedEventMapper).
|
||||
RegisterFilterEventMapper(OrgIAMPolicyRemovedEventType, OrgIAMPolicyRemovedEventMapper).
|
||||
RegisterFilterEventMapper(OrgDomainPolicyAddedEventType, OrgDomainPolicyAddedEventMapper).
|
||||
RegisterFilterEventMapper(OrgDomainPolicyChangedEventType, OrgDomainPolicyChangedEventMapper).
|
||||
RegisterFilterEventMapper(OrgDomainPolicyRemovedEventType, OrgDomainPolicyRemovedEventMapper).
|
||||
RegisterFilterEventMapper(PasswordAgePolicyAddedEventType, PasswordAgePolicyAddedEventMapper).
|
||||
RegisterFilterEventMapper(PasswordAgePolicyChangedEventType, PasswordAgePolicyChangedEventMapper).
|
||||
RegisterFilterEventMapper(PasswordAgePolicyRemovedEventType, PasswordAgePolicyRemovedEventMapper).
|
||||
|
103
internal/repository/org/policy_org_domain.go
Normal file
103
internal/repository/org/policy_org_domain.go
Normal file
@@ -0,0 +1,103 @@
|
||||
package org
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/repository"
|
||||
"github.com/caos/zitadel/internal/repository/policy"
|
||||
)
|
||||
|
||||
var (
|
||||
OrgDomainPolicyAddedEventType = orgEventTypePrefix + policy.DomainPolicyAddedEventType
|
||||
OrgDomainPolicyChangedEventType = orgEventTypePrefix + policy.DomainPolicyChangedEventType
|
||||
OrgDomainPolicyRemovedEventType = orgEventTypePrefix + policy.DomainPolicyRemovedEventType
|
||||
)
|
||||
|
||||
type OrgDomainPolicyAddedEvent struct {
|
||||
policy.DomainPolicyAddedEvent
|
||||
}
|
||||
|
||||
func NewOrgDomainPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
userLoginMustBeDomain bool,
|
||||
) *OrgDomainPolicyAddedEvent {
|
||||
return &OrgDomainPolicyAddedEvent{
|
||||
DomainPolicyAddedEvent: *policy.NewDomainPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgDomainPolicyAddedEventType),
|
||||
userLoginMustBeDomain,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func OrgDomainPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := policy.DomainPolicyAddedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OrgDomainPolicyAddedEvent{DomainPolicyAddedEvent: *e.(*policy.DomainPolicyAddedEvent)}, nil
|
||||
}
|
||||
|
||||
type OrgDomainPolicyChangedEvent struct {
|
||||
policy.DomainPolicyChangedEvent
|
||||
}
|
||||
|
||||
func NewOrgDomainPolicyChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.OrgPolicyChanges,
|
||||
) (*OrgDomainPolicyChangedEvent, error) {
|
||||
changedEvent, err := policy.NewDomainPolicyChangedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgDomainPolicyChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &OrgDomainPolicyChangedEvent{DomainPolicyChangedEvent: *changedEvent}, nil
|
||||
}
|
||||
|
||||
func OrgDomainPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := policy.DomainPolicyChangedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OrgDomainPolicyChangedEvent{DomainPolicyChangedEvent: *e.(*policy.DomainPolicyChangedEvent)}, nil
|
||||
}
|
||||
|
||||
type OrgDomainPolicyRemovedEvent struct {
|
||||
policy.DomainPolicyRemovedEvent
|
||||
}
|
||||
|
||||
func NewOrgDomainPolicyRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
) *OrgDomainPolicyRemovedEvent {
|
||||
return &OrgDomainPolicyRemovedEvent{
|
||||
DomainPolicyRemovedEvent: *policy.NewDomainPolicyRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgDomainPolicyRemovedEventType),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func OrgDomainPolicyRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := policy.DomainPolicyRemovedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OrgDomainPolicyRemovedEvent{DomainPolicyRemovedEvent: *e.(*policy.DomainPolicyRemovedEvent)}, nil
|
||||
}
|
@@ -1,106 +0,0 @@
|
||||
package org
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/repository"
|
||||
"github.com/caos/zitadel/internal/repository/policy"
|
||||
)
|
||||
|
||||
var (
|
||||
//TODO: enable when possible
|
||||
//OrgIAMPolicyAddedEventType = orgEventTypePrefix + policy.OrgIAMPolicyAddedEventType
|
||||
//OrgIAMPolicyChangedEventType = orgEventTypePrefix + policy.OrgIAMPolicyChangedEventType
|
||||
OrgIAMPolicyAddedEventType = orgEventTypePrefix + "iam.policy.added"
|
||||
OrgIAMPolicyChangedEventType = orgEventTypePrefix + "iam.policy.changed"
|
||||
OrgIAMPolicyRemovedEventType = orgEventTypePrefix + "iam.policy.removed"
|
||||
)
|
||||
|
||||
type OrgIAMPolicyAddedEvent struct {
|
||||
policy.OrgIAMPolicyAddedEvent
|
||||
}
|
||||
|
||||
func NewOrgIAMPolicyAddedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
userLoginMustBeDomain bool,
|
||||
) *OrgIAMPolicyAddedEvent {
|
||||
return &OrgIAMPolicyAddedEvent{
|
||||
OrgIAMPolicyAddedEvent: *policy.NewOrgIAMPolicyAddedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgIAMPolicyAddedEventType),
|
||||
userLoginMustBeDomain,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func OrgIAMPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := policy.OrgIAMPolicyAddedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OrgIAMPolicyAddedEvent{OrgIAMPolicyAddedEvent: *e.(*policy.OrgIAMPolicyAddedEvent)}, nil
|
||||
}
|
||||
|
||||
type OrgIAMPolicyChangedEvent struct {
|
||||
policy.OrgIAMPolicyChangedEvent
|
||||
}
|
||||
|
||||
func NewOrgIAMPolicyChangedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
changes []policy.OrgIAMPolicyChanges,
|
||||
) (*OrgIAMPolicyChangedEvent, error) {
|
||||
changedEvent, err := policy.NewOrgIAMPolicyChangedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgIAMPolicyChangedEventType),
|
||||
changes,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &OrgIAMPolicyChangedEvent{OrgIAMPolicyChangedEvent: *changedEvent}, nil
|
||||
}
|
||||
|
||||
func OrgIAMPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := policy.OrgIAMPolicyChangedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OrgIAMPolicyChangedEvent{OrgIAMPolicyChangedEvent: *e.(*policy.OrgIAMPolicyChangedEvent)}, nil
|
||||
}
|
||||
|
||||
type OrgIAMPolicyRemovedEvent struct {
|
||||
policy.OrgIAMPolicyRemovedEvent
|
||||
}
|
||||
|
||||
func NewOrgIAMPolicyRemovedEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
) *OrgIAMPolicyRemovedEvent {
|
||||
return &OrgIAMPolicyRemovedEvent{
|
||||
OrgIAMPolicyRemovedEvent: *policy.NewOrgIAMPolicyRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
OrgIAMPolicyRemovedEventType),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func OrgIAMPolicyRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e, err := policy.OrgIAMPolicyRemovedEventMapper(event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &OrgIAMPolicyRemovedEvent{OrgIAMPolicyRemovedEvent: *e.(*policy.OrgIAMPolicyRemovedEvent)}, nil
|
||||
}
|
@@ -11,37 +11,38 @@ import (
|
||||
|
||||
const (
|
||||
//TODO: use for org events as suffix (when possible)
|
||||
OrgIAMPolicyAddedEventType = "policy.org.iam.added"
|
||||
OrgIAMPolicyChangedEventType = "policy.org.iam.changed"
|
||||
DomainPolicyAddedEventType = "policy.domain.added"
|
||||
DomainPolicyChangedEventType = "policy.domain.changed"
|
||||
DomainPolicyRemovedEventType = "policy.domain.removed"
|
||||
)
|
||||
|
||||
type OrgIAMPolicyAddedEvent struct {
|
||||
type DomainPolicyAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
UserLoginMustBeDomain bool `json:"userLoginMustBeDomain,omitempty"`
|
||||
}
|
||||
|
||||
func (e *OrgIAMPolicyAddedEvent) Data() interface{} {
|
||||
func (e *DomainPolicyAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *OrgIAMPolicyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *DomainPolicyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewOrgIAMPolicyAddedEvent(
|
||||
func NewDomainPolicyAddedEvent(
|
||||
base *eventstore.BaseEvent,
|
||||
userLoginMustBeDomain bool,
|
||||
) *OrgIAMPolicyAddedEvent {
|
||||
) *DomainPolicyAddedEvent {
|
||||
|
||||
return &OrgIAMPolicyAddedEvent{
|
||||
return &DomainPolicyAddedEvent{
|
||||
BaseEvent: *base,
|
||||
UserLoginMustBeDomain: userLoginMustBeDomain,
|
||||
}
|
||||
}
|
||||
|
||||
func OrgIAMPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e := &OrgIAMPolicyAddedEvent{
|
||||
func DomainPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e := &DomainPolicyAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
@@ -53,28 +54,28 @@ func OrgIAMPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, er
|
||||
return e, nil
|
||||
}
|
||||
|
||||
type OrgIAMPolicyChangedEvent struct {
|
||||
type DomainPolicyChangedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
UserLoginMustBeDomain *bool `json:"userLoginMustBeDomain,omitempty"`
|
||||
}
|
||||
|
||||
func (e *OrgIAMPolicyChangedEvent) Data() interface{} {
|
||||
func (e *DomainPolicyChangedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *OrgIAMPolicyChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *DomainPolicyChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewOrgIAMPolicyChangedEvent(
|
||||
func NewDomainPolicyChangedEvent(
|
||||
base *eventstore.BaseEvent,
|
||||
changes []OrgIAMPolicyChanges,
|
||||
) (*OrgIAMPolicyChangedEvent, error) {
|
||||
changes []OrgPolicyChanges,
|
||||
) (*DomainPolicyChangedEvent, error) {
|
||||
if len(changes) == 0 {
|
||||
return nil, errors.ThrowPreconditionFailed(nil, "POLICY-DAf3h", "Errors.NoChangesFound")
|
||||
}
|
||||
changeEvent := &OrgIAMPolicyChangedEvent{
|
||||
changeEvent := &DomainPolicyChangedEvent{
|
||||
BaseEvent: *base,
|
||||
}
|
||||
for _, change := range changes {
|
||||
@@ -83,16 +84,16 @@ func NewOrgIAMPolicyChangedEvent(
|
||||
return changeEvent, nil
|
||||
}
|
||||
|
||||
type OrgIAMPolicyChanges func(*OrgIAMPolicyChangedEvent)
|
||||
type OrgPolicyChanges func(*DomainPolicyChangedEvent)
|
||||
|
||||
func ChangeUserLoginMustBeDomain(userLoginMustBeDomain bool) func(*OrgIAMPolicyChangedEvent) {
|
||||
return func(e *OrgIAMPolicyChangedEvent) {
|
||||
func ChangeUserLoginMustBeDomain(userLoginMustBeDomain bool) func(*DomainPolicyChangedEvent) {
|
||||
return func(e *DomainPolicyChangedEvent) {
|
||||
e.UserLoginMustBeDomain = &userLoginMustBeDomain
|
||||
}
|
||||
}
|
||||
|
||||
func OrgIAMPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e := &OrgIAMPolicyChangedEvent{
|
||||
func DomainPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e := &DomainPolicyChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
@@ -104,26 +105,26 @@ func OrgIAMPolicyChangedEventMapper(event *repository.Event) (eventstore.Event,
|
||||
return e, nil
|
||||
}
|
||||
|
||||
type OrgIAMPolicyRemovedEvent struct {
|
||||
type DomainPolicyRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *OrgIAMPolicyRemovedEvent) Data() interface{} {
|
||||
func (e *DomainPolicyRemovedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *OrgIAMPolicyRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *DomainPolicyRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewOrgIAMPolicyRemovedEvent(base *eventstore.BaseEvent) *OrgIAMPolicyRemovedEvent {
|
||||
return &OrgIAMPolicyRemovedEvent{
|
||||
func NewDomainPolicyRemovedEvent(base *eventstore.BaseEvent) *DomainPolicyRemovedEvent {
|
||||
return &DomainPolicyRemovedEvent{
|
||||
BaseEvent: *base,
|
||||
}
|
||||
}
|
||||
|
||||
func OrgIAMPolicyRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
return &OrgIAMPolicyRemovedEvent{
|
||||
func DomainPolicyRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
return &DomainPolicyRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
Reference in New Issue
Block a user