This commit is contained in:
Elio Bischof 2023-07-03 12:25:58 +02:00
parent 2a1149a67a
commit 1d64cc6129
No known key found for this signature in database
GPG Key ID: 7B383FDE4DDBF1BD
3 changed files with 12 additions and 2 deletions

View File

@ -2,6 +2,8 @@ package projection
import ( import (
"context" "context"
"strconv"
"strings"
"github.com/zitadel/zitadel/internal/eventstore" "github.com/zitadel/zitadel/internal/eventstore"
"github.com/zitadel/zitadel/internal/eventstore/handler" "github.com/zitadel/zitadel/internal/eventstore/handler"
@ -286,5 +288,11 @@ func (p *milestoneProjection) reduceAppConfigAdded(event eventstore.Event, clien
} }
func (p *milestoneProjection) isSystemEvent(event eventstore.Event) bool { func (p *milestoneProjection) isSystemEvent(event eventstore.Event) bool {
return event.EditorUser() == "" || event.EditorService() == "" || event.EditorService() == "SYSTEM" if _, err := strconv.Atoi(event.EditorUser()); err == nil {
return false
}
lowerEditorService := strings.ToLower(event.EditorService())
return lowerEditorService == "" ||
lowerEditorService == "system" ||
lowerEditorService == "system-api"
} }

View File

@ -338,7 +338,6 @@ func (q *Queries) GetUserByID(ctx context.Context, shouldTriggerBulk bool, userI
defer func() { span.EndWithError(err) }() defer func() { span.EndWithError(err) }()
if shouldTriggerBulk { if shouldTriggerBulk {
// TODO: Why are these errors not handled?
projection.UserProjection.Trigger(ctx) projection.UserProjection.Trigger(ctx)
projection.LoginNameProjection.Trigger(ctx) projection.LoginNameProjection.Trigger(ctx)
} }

View File

@ -1,3 +1,4 @@
// Package pseudo contains virtual events, that are not stored in the eventstore.
package pseudo package pseudo
import ( import (
@ -20,6 +21,8 @@ type ScheduledEvent struct {
InstanceIDs []string `json:"-"` InstanceIDs []string `json:"-"`
} }
// NewScheduledEvent returns an event that can be processed by event handlers like any other event.
// It receives the current timestamp and an ID list of instances that are active and should be processed.
func NewScheduledEvent( func NewScheduledEvent(
ctx context.Context, ctx context.Context,
timestamp time.Time, timestamp time.Time,