mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-30 07:58:51 +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 <[email protected]>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
"github.com/caos/zitadel/internal/repository/instance"
|
||||
)
|
||||
|
||||
type InstanceIdentityProviderWriteModel struct {
|
||||
IdentityProviderWriteModel
|
||||
}
|
||||
|
||||
func NewInstanceIdentityProviderWriteModel(idpConfigID string) *InstanceIdentityProviderWriteModel {
|
||||
return &InstanceIdentityProviderWriteModel{
|
||||
IdentityProviderWriteModel: IdentityProviderWriteModel{
|
||||
WriteModel: eventstore.WriteModel{
|
||||
AggregateID: domain.IAMID,
|
||||
ResourceOwner: domain.IAMID,
|
||||
},
|
||||
IDPConfigID: idpConfigID,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (wm *InstanceIdentityProviderWriteModel) AppendEvents(events ...eventstore.Event) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *instance.IdentityProviderAddedEvent:
|
||||
if e.IDPConfigID != wm.IDPConfigID {
|
||||
continue
|
||||
}
|
||||
wm.IdentityProviderWriteModel.AppendEvents(&e.IdentityProviderAddedEvent)
|
||||
case *instance.IdentityProviderRemovedEvent:
|
||||
if e.IDPConfigID != wm.IDPConfigID {
|
||||
continue
|
||||
}
|
||||
wm.IdentityProviderWriteModel.AppendEvents(&e.IdentityProviderRemovedEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (wm *InstanceIdentityProviderWriteModel) Reduce() error {
|
||||
return wm.IdentityProviderWriteModel.Reduce()
|
||||
}
|
||||
|
||||
func (wm *InstanceIdentityProviderWriteModel) Query() *eventstore.SearchQueryBuilder {
|
||||
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent).
|
||||
ResourceOwner(wm.ResourceOwner).
|
||||
AddQuery().
|
||||
AggregateTypes(instance.AggregateType).
|
||||
AggregateIDs(wm.AggregateID).
|
||||
Builder()
|
||||
}
|
||||
Reference in New Issue
Block a user