fix: todos (#1502)

* fix: remove console log

* fix: remove todos

* fix: setup uniqueness

* fix: setup uniqueness
This commit is contained in:
Fabi 2021-03-31 11:10:06 +02:00 committed by GitHub
parent fa6fb92c7e
commit d1284082a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 32 additions and 16 deletions

View File

@ -65,13 +65,6 @@ func HumanToPb(view *model.HumanView) *user_pb.Human {
Phone: view.Phone,
IsPhoneVerified: view.IsPhoneVerified,
},
Address: &user_pb.Address{ //TODO: remove?
Country: view.Country,
Locality: view.Locality,
PostalCode: view.PostalCode,
Region: view.Region,
StreetAddress: view.StreetAddress,
},
}
}

View File

@ -29,7 +29,6 @@ func (v *View) updateSpoolerRunSequence(viewName string) error {
}
currentSequence.LastSuccessfulSpoolerRun = time.Now()
//update all aggregate types
//TODO: not sure if all scenarios work as expected
currentSequence.AggregateType = ""
return repository.UpdateCurrentSequence(v.Db, sequencesTable, currentSequence)
}

View File

@ -29,7 +29,6 @@ func (v *View) updateSpoolerRunSequence(viewName string) error {
}
currentSequence.LastSuccessfulSpoolerRun = time.Now()
//update all aggregate types
//TODO: not sure if all scenarios work as expected
currentSequence.AggregateType = ""
return repository.UpdateCurrentSequence(v.Db, sequencesTable, currentSequence)
}

View File

@ -74,7 +74,6 @@ func (c *Commands) ChangeMachine(ctx context.Context, machine *domain.Machine) (
return writeModelToMachine(existingMachine), nil
}
//TODO: adlerhurst we should check userID on the same level, in user.go userID is checked in public funcs
func (c *Commands) machineWriteModelByID(ctx context.Context, userID, resourceOwner string) (writeModel *MachineWriteModel, err error) {
if userID == "" {
return nil, caos_errs.ThrowInvalidArgument(nil, "COMMAND-0Plof", "Errors.User.UserIDMissing")

View File

@ -32,8 +32,6 @@ func (wm *MachineKeyWriteModel) AppendEvents(events ...eventstore.EventReader) {
for _, event := range events {
switch e := event.(type) {
case *user.MachineKeyAddedEvent:
//TODO: adlerhurst we should decide who should handle the correct event appending
// IMO in this append events we should only get events with the correct keyID
if wm.KeyID != e.KeyID {
continue
}

View File

@ -29,7 +29,6 @@ func (v *View) updateSpoolerRunSequence(viewName string) error {
}
currentSequence.LastSuccessfulSpoolerRun = time.Now()
//update all aggregate types
//TODO: not sure if all scenarios work as expected
currentSequence.AggregateType = ""
return repository.UpdateCurrentSequence(v.Db, sequencesTable, currentSequence)
}

View File

@ -29,7 +29,6 @@ func (v *View) updateSpoolerRunSequence(viewName string) error {
}
currentSequence.LastSuccessfulSpoolerRun = time.Now()
//update all aggregate types
//TODO: not sure if all scenarios work as expected
currentSequence.AggregateType = ""
return repository.UpdateCurrentSequence(v.Db, sequencesTable, currentSequence)
}

View File

@ -3,6 +3,7 @@ package iam
import (
"context"
"encoding/json"
"strconv"
"github.com/caos/zitadel/internal/eventstore"
@ -12,6 +13,8 @@ import (
)
const (
UniqueStepStarted = "stepstarted"
UniqueStepDone = "stepdone"
SetupDoneEventType eventstore.EventType = "iam.setup.done"
SetupStartedEventType eventstore.EventType = "iam.setup.started"
)
@ -23,12 +26,30 @@ type SetupStepEvent struct {
Done bool `json:"-"`
}
func NewAddSetupStepStartedUniqueConstraint(step domain.Step) *eventstore.EventUniqueConstraint {
return eventstore.NewAddEventUniqueConstraint(
UniqueStepStarted,
strconv.Itoa(int(step)),
"Errors.Step.Started.AlreadyExists")
}
func NewAddSetupStepDoneUniqueConstraint(step domain.Step) *eventstore.EventUniqueConstraint {
return eventstore.NewAddEventUniqueConstraint(
UniqueStepDone,
strconv.Itoa(int(step)),
"Errors.Step.Done.AlreadyExists")
}
func (e *SetupStepEvent) Data() interface{} {
return e
}
func (e *SetupStepEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
return nil
if e.Done {
return []*eventstore.EventUniqueConstraint{NewAddSetupStepDoneUniqueConstraint(e.Step)}
} else {
return []*eventstore.EventUniqueConstraint{NewAddSetupStepStartedUniqueConstraint(e.Step)}
}
}
func SetupStepMapper(event *repository.Event) (eventstore.EventReader, error) {

View File

@ -309,6 +309,11 @@ Errors:
LoginPolicy:
MFA:
ForceAndNotConfigured: Multifaktor ist als zwingend konfiguriert, jedoch sind keine möglichen Provider hinterlegt. Bitte melde dich beim Administrator des Systems.
Step:
Started:
AlreadyExists: Schritt gestartet existiert bereits
Done:
AlreadyExists: Schritt ausgeführt existiert bereits
EventTypes:
user:
added: Benutzer hinzugefügt

View File

@ -310,6 +310,11 @@ Errors:
LoginPolicy:
MFA:
ForceAndNotConfigured: Multifactor is configured as required, but no possible providers are configured. Please contact your system administrator.
Step:
Started:
AlreadyExists: Step started already exists
Done:
AlreadyExists: Step done already exists
EventTypes:
user:
added: User added

View File

@ -8,7 +8,6 @@ function login() {
makeAssertionOptions.publicKey.allowCredentials.forEach(function (listItem) {
listItem.id = bufferDecode(listItem.id)
});
console.log(makeAssertionOptions);
navigator.credentials.get({
publicKey: makeAssertionOptions.publicKey
}).then(function (credential) {