From 44d41b8d97d31b1fcd31be70a08325634f280740 Mon Sep 17 00:00:00 2001 From: Livio Amstutz Date: Thu, 11 Jun 2020 14:59:57 +0200 Subject: [PATCH] fix: failed events (#211) * fix: add iam roles to permissions * fix: show state initial on usersearch * fix: search project roles returns only roles of project * fix: add project member owner on project create * fix: create new object oon failed event * feat: parse error body on chat message * feat: remove comment * fix: set policy eventstore in admin * fix failed events * fix resend for password set * fix: create user with correct resource owner Co-authored-by: Fabiennne --- internal/login/handler/init_password_handler.go | 6 +++++- internal/user/repository/eventsourcing/user.go | 2 +- internal/view/failed_events.go | 6 +++--- internal/view/sequence.go | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/login/handler/init_password_handler.go b/internal/login/handler/init_password_handler.go index 57b138d50..9982a312f 100644 --- a/internal/login/handler/init_password_handler.go +++ b/internal/login/handler/init_password_handler.go @@ -68,7 +68,11 @@ func (l *Login) checkPWCode(w http.ResponseWriter, r *http.Request, authReq *mod } func (l *Login) resendPasswordSet(w http.ResponseWriter, r *http.Request, authReq *model.AuthRequest) { - err := l.authRepo.RequestPasswordReset(r.Context(), authReq.UserName) + userOrg := login + if authReq != nil { + userOrg = authReq.UserOrgID + } + err := l.authRepo.RequestPasswordReset(setContext(r.Context(), userOrg), authReq.UserName) l.renderInitPassword(w, r, authReq, authReq.UserID, "", err) } diff --git a/internal/user/repository/eventsourcing/user.go b/internal/user/repository/eventsourcing/user.go index ebb568340..73b6ad973 100644 --- a/internal/user/repository/eventsourcing/user.go +++ b/internal/user/repository/eventsourcing/user.go @@ -60,7 +60,7 @@ func UserCreateAggregate(ctx context.Context, aggCreator *es_models.AggregateCre var agg *es_models.Aggregate if resourceOwner != "" { - agg, err = UserAggregateOverwriteContext(ctx, aggCreator, user, user.AggregateID, resourceOwner) + agg, err = UserAggregateOverwriteContext(ctx, aggCreator, user, resourceOwner, user.AggregateID) } else { agg, err = UserAggregate(ctx, aggCreator, user) } diff --git a/internal/view/failed_events.go b/internal/view/failed_events.go index c46579955..1dbac725e 100644 --- a/internal/view/failed_events.go +++ b/internal/view/failed_events.go @@ -13,9 +13,9 @@ const ( type FailedEvent struct { ViewName string `gorm:"column:view_name;primary_key"` - FailedSequence uint64 `gorm:"column:failed_sequence;primary_key` - FailureCount uint64 `gorm:"column:failure_count` - ErrMsg string `gorm:"column:err_msg` + FailedSequence uint64 `gorm:"column:failed_sequence;primary_key"` + FailureCount uint64 `gorm:"column:failure_count"` + ErrMsg string `gorm:"column:err_msg"` } type FailedEventSearchQuery struct { diff --git a/internal/view/sequence.go b/internal/view/sequence.go index 6fbfd3429..96da06b33 100644 --- a/internal/view/sequence.go +++ b/internal/view/sequence.go @@ -11,7 +11,7 @@ type actualSequece struct { type currentSequence struct { ViewName string `gorm:"column:view_name;primary_key"` - CurrentSequence uint64 `gorm:"column:current_sequence` + CurrentSequence uint64 `gorm:"column:current_sequence"` } type SequenceSearchKey int32