You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2026/09/17 10:00:54 UTC
(unomi) 01/02: Combine the profile scope with client event filters instead of replacing it
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch graphql-scope-profile-events-filter
in repository https://gitbox.apache.org/repos/asf/unomi.git
commit 916dcdfd016ec5d709bf9bfe8652d885579b206b
Author: Serge Huber <sh...@apache.org>
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 <no...@anthropic.com>
---
.../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());