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:
@@ -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
|
||||
}
|
Reference in New Issue
Block a user