mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:17: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:
56
internal/repository/instance/event_org_set.go
Normal file
56
internal/repository/instance/event_org_set.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/repository"
|
||||
)
|
||||
|
||||
const (
|
||||
GlobalOrgSetEventType eventstore.EventType = "iam.global.org.set"
|
||||
)
|
||||
|
||||
type GlobalOrgSetEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
OrgID string `json:"globalOrgId"`
|
||||
}
|
||||
|
||||
func (e *GlobalOrgSetEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *GlobalOrgSetEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewGlobalOrgSetEventEvent(
|
||||
ctx context.Context,
|
||||
aggregate *eventstore.Aggregate,
|
||||
orgID string,
|
||||
) *GlobalOrgSetEvent {
|
||||
return &GlobalOrgSetEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
aggregate,
|
||||
GlobalOrgSetEventType,
|
||||
),
|
||||
OrgID: orgID,
|
||||
}
|
||||
}
|
||||
|
||||
func GlobalOrgSetMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e := &GlobalOrgSetEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, e)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "IAM-cdFZH", "unable to unmarshal global org set")
|
||||
}
|
||||
|
||||
return e, nil
|
||||
}
|
Reference in New Issue
Block a user