This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch bound-matchesregex-condition-evaluation in repository https://gitbox.apache.org/repos/asf/unomi.git
commit c8605a648bd36d116bdf5557e974373649678be4 Author: Serge Huber <[email protected]> AuthorDate: Fri Aug 21 12:05:16 2026 +0200 Combine the profile scope with client event filters instead of replacing it When listing a profile's events, the "profileId" scope condition was used only when no client filter was supplied; supplying a filter replaced it entirely, so the query was no longer restricted to that profile. Always AND the profile condition with the converted filter condition. Co-Authored-By: Claude Opus 4.8 <[email protected]> --- .../profile/ProfileAllEventsConnectionDataFetcher.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/fetchers/profile/ProfileAllEventsConnectionDataFetcher.java b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/fetchers/profile/ProfileAllEventsConnectionDataFetcher.java index 5228f10e6..56d594421 100644 --- a/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/fetchers/profile/ProfileAllEventsConnectionDataFetcher.java +++ b/graphql/cxs-impl/src/main/java/org/apache/unomi/graphql/fetchers/profile/ProfileAllEventsConnectionDataFetcher.java @@ -30,6 +30,7 @@ import org.apache.unomi.graphql.services.ServiceManager; import org.apache.unomi.graphql.types.input.CDPEventFilterInput; import org.apache.unomi.graphql.types.output.CDPEventConnection; +import java.util.Arrays; import java.util.Map; public class ProfileAllEventsConnectionDataFetcher extends EventConnectionDataFetcher { @@ -49,14 +50,20 @@ public class ProfileAllEventsConnectionDataFetcher extends EventConnectionDataFe final EventConditionFactory eventConditionFactory = EventConditionFactory.get(environment); + // The profile scope is a boundary, not a default: it must be combined with any client filter, + // never replaced by it. Replacing it let a supplied filter widen the query beyond this profile. + final Condition profileCondition = eventConditionFactory.propertyCondition("profileId", profile.getItemId()); + Condition condition; if (filterInput == null) { - condition = eventConditionFactory.propertyCondition("profileId", profile.getItemId()); + condition = profileCondition; } else { final Map<String, Object> filterInputAsMap = environment.getArgument("filter"); - condition = eventConditionFactory.eventFilterInputCondition(filterInput, filterInputAsMap); + condition = eventConditionFactory.booleanCondition("and", Arrays.asList( + profileCondition, + eventConditionFactory.eventFilterInputCondition(filterInput, filterInputAsMap))); } final PartialList<Event> events = serviceManager.getService(EventService.class).searchEvents(condition, params.getOffset(), params.getSize());
