mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
959530ddad
* fix: correct selectors for extended writemodel * fix: no previous checks in eventstore * start check previous * feat: auth user commands * feat: auth user commands * feat: auth user commands * feat: otp * feat: corrections from pr merge * feat: webauthn * feat: comment old webauthn * feat: refactor user, human, machine * feat: webauth command side * feat: command and query side in login * feat: fix user writemodel append events * fix: remove creation dates on command side * fix: remove previous sequence * previous sequence * fix: external idps * Update internal/api/grpc/management/user.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * Update internal/v2/command/user_human_email.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix: pr changes * fix: phone verification Co-authored-by: adlerhurst <silvan.reusser@gmail.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com>
47 lines
1002 B
Go
47 lines
1002 B
Go
package iam
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
|
|
"github.com/caos/zitadel/internal/errors"
|
|
"github.com/caos/zitadel/internal/eventstore/v2"
|
|
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
|
)
|
|
|
|
const (
|
|
ProjectSetEventType eventstore.EventType = "iam.project.iam.set"
|
|
)
|
|
|
|
type ProjectSetEvent struct {
|
|
eventstore.BaseEvent `json:"-"`
|
|
|
|
ProjectID string `json:"iamProjectId"`
|
|
}
|
|
|
|
func (e *ProjectSetEvent) Data() interface{} {
|
|
return e
|
|
}
|
|
|
|
func NewIAMProjectSetEvent(ctx context.Context, projectID string) *ProjectSetEvent {
|
|
return &ProjectSetEvent{
|
|
BaseEvent: *eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
ProjectSetEventType,
|
|
),
|
|
ProjectID: projectID,
|
|
}
|
|
}
|
|
|
|
func ProjectSetMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e := &ProjectSetEvent{
|
|
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
|
|
}
|