fix: combine resourceowner query in reduce function for user grant (#7383)

* fix: projection reduce correction with unit tests

* fix: remove eventcout variable as not used anymore

* fix: add errors if resoureowner is not found in user grants reduce
This commit is contained in:
Stefan Benz
2024-03-08 08:52:59 +01:00
committed by GitHub
parent 213c425806
commit 6df4b1b2c2
7 changed files with 551 additions and 16 deletions

View File

@@ -126,6 +126,12 @@ func (p *projectGrantMemberProjection) reduceAdded(event eventstore.Event) (*han
}
ctx := setMemberContext(e.Aggregate())
userOwner, _, grantedOrg, err := getResourceOwners(ctx, p.es, e.Aggregate().InstanceID, e.UserID, e.Aggregate().ID, e.GrantID)
if userOwner == "" {
return nil, zerrors.ThrowNotFound(nil, "PROJ-cuvy6nu1tq", "Errors.NotFound")
}
if grantedOrg == "" {
return nil, zerrors.ThrowNotFound(nil, "PROJ-i178hq18k4", "Errors.NotFound")
}
if err != nil {
return nil, err
}