mirror of
https://github.com/andwati/zitadel.git
synced 2026-12-02 08:58:52 +00:00
idp
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
es_repo "github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -40,7 +40,7 @@ func NewAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
func AddedEventMapper(event *es_repo.Event) (eventstore.EventReader, error) {
|
||||
e := &AddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ type ChangedEvent struct {
|
||||
|
||||
Roles []string `json:"roles,omitempty"`
|
||||
UserID string `json:"userId,omitempty"`
|
||||
|
||||
hasChanged bool
|
||||
}
|
||||
|
||||
func (e *ChangedEvent) CheckPrevious() bool {
|
||||
@@ -38,15 +36,16 @@ func ChangeEventFromExisting(
|
||||
) (*ChangedEvent, error) {
|
||||
|
||||
change := NewChangedEvent(base, current.userID)
|
||||
hasChanged := false
|
||||
|
||||
sort.Strings(current.Roles)
|
||||
sort.Strings(roles)
|
||||
if !reflect.DeepEqual(current.Roles, roles) {
|
||||
change.Roles = roles
|
||||
change.hasChanged = true
|
||||
hasChanged = true
|
||||
}
|
||||
|
||||
if !change.hasChanged {
|
||||
if !hasChanged {
|
||||
return nil, errors.ThrowPreconditionFailed(nil, "MEMBE-SeKlD", "Errors.NoChanges")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user