diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/component/dialog/SynchronizationDialog.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/component/dialog/SynchronizationDialog.java index 71998ca7d4c..c2a3ad70ecd 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/component/dialog/SynchronizationDialog.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/component/dialog/SynchronizationDialog.java @@ -372,11 +372,11 @@ private void showRepullProgressItems() { addEntityIfViewAllowed(ImmunizationDto.class, Strings.entityImmunizations, allowedEntities); addEntityIfViewAllowed(EventDto.class, Strings.entityEvents, allowedEntities); addEntityIfViewAllowed(EventParticipantDto.class, Strings.entityEventParticipants, allowedEntities); + addEntityIfViewAllowed(EnvironmentDto.class, Strings.entityEnvironments, allowedEntities); + addEntityIfViewAllowed(EnvironmentSampleDto.class, Strings.entityEnvironmentSamples, allowedEntities); addEntityIfViewAllowed(SampleDto.class, Strings.entitySamples, allowedEntities); addEntityIfViewAllowed(PathogenTestDto.class, Strings.entityPathogenTests, allowedEntities); addEntityIfViewAllowed(AdditionalTestDto.class, Strings.entityAdditionalTests, allowedEntities); - addEntityIfViewAllowed(EnvironmentDto.class, Strings.entityEnvironments, allowedEntities); - addEntityIfViewAllowed(EnvironmentSampleDto.class, Strings.entityEnvironmentSamples, allowedEntities); addEntityIfViewAllowed(ContactDto.class, Strings.entityContacts, allowedEntities); addEntityIfViewAllowed(VisitDto.class, Strings.entityVisits, allowedEntities); addEntityIfViewAllowed(TaskDto.class, Strings.entityTasks, allowedEntities); diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/task/TaskService.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/task/TaskService.java index fe11650cbd6..0daf00b0793 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/task/TaskService.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/task/TaskService.java @@ -127,6 +127,9 @@ protected Predicate createRelevantDataFilter(CriteriaBuilder cb, CriteriaQuery c filter = CriteriaBuilderHelper.and(cb, filter, createUserFilter(taskQueryContext)); } + Predicate criteriaFilter = this.buildCriteriaFilter(new TaskCriteria(), taskQueryContext); + filter = CriteriaBuilderHelper.and(cb, filter, criteriaFilter); + return filter; } @@ -144,6 +147,9 @@ public List getAllActiveUuids(User user) { filter = CriteriaBuilderHelper.and(cb, filter, userFilter); } + Predicate criteriaFilter = this.buildCriteriaFilter(new TaskCriteria(), taskQueryContext); + filter = CriteriaBuilderHelper.and(cb, filter, criteriaFilter); + if (RequestContextHolder.isMobileSync()) { Predicate predicate = createLimitedChangeDateFilter(cb, from); if (predicate != null) { @@ -190,7 +196,9 @@ private boolean hasContextOrNoContext(TaskCriteria taskCriteria, TaskContext tas || !taskCriteria.hasContextCriteria() || (taskCriteria.getTaskContext() == TaskContext.TRAVEL_ENTRY || taskCriteria.getTravelEntry() != null); case ENVIRONMENT: - return taskCriteria == null || (taskCriteria.getTaskContext() == TaskContext.ENVIRONMENT || taskCriteria.getEnvironment() != null); + return taskCriteria == null + || !taskCriteria.hasContextCriteria() + || (taskCriteria.getTaskContext() == TaskContext.ENVIRONMENT || taskCriteria.getEnvironment() != null); case GENERAL: return taskCriteria == null || !taskCriteria.hasContextCriteria() || taskCriteria.getTaskContext() == TaskContext.GENERAL; default: diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserFacadeEjb.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserFacadeEjb.java index e0903bcf925..832ebba7c29 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserFacadeEjb.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserFacadeEjb.java @@ -241,7 +241,6 @@ public List getUsersByRegionAndRights(RegionReferenceDto regio null, null, true, - true, limitedDisease, userRights) .stream() @@ -316,7 +315,6 @@ public List getUserRefsByDistrict(DistrictReferenceDto distric districtRef != null ? Collections.singletonList(districtRef.getUuid()) : null, null, true, - true, limitedDisease, userRights) .stream() @@ -336,7 +334,6 @@ public List getUserRefsByDistrict( districtRef != null ? Collections.singletonList(districtRef.getUuid()) : null, null, true, - true, null, excludeLimitedDiseaseUsers, Arrays.asList(userRights)) @@ -355,7 +352,6 @@ public List getUserRefsByDistricts(List districtRefs.stream().map(DistrictReferenceDto::getUuid).collect(Collectors.toList()), null, true, - true, limitedDisease, userRights) .stream() @@ -392,10 +388,7 @@ public List getUserRefsByInfrastructure( @PermitAll public List getAllUserRefs(boolean includeInactive) { - return userService.getUserReferences(null, null, true, !includeInactive) - .stream() - .map(UserFacadeEjb::toReferenceDto) - .collect(Collectors.toList()); + return userService.getUserReferences(null, null, !includeInactive).stream().map(UserFacadeEjb::toReferenceDto).collect(Collectors.toList()); } private List getAssignableUsersBasedOnContext(TaskContextIndexCriteria taskContextIndexCriteria) { diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserService.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserService.java index 2b11f36b0be..bdd1ab40831 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserService.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/user/UserService.java @@ -198,43 +198,28 @@ public List getAllByDistrictsAndUserRights(List districts, Colle * @param activeOnly * @param userRights */ - public List getUserReferences( - List regionUuids, - List districtUuids, - boolean filterByCurrentUserJurisdiction, - boolean activeOnly, - UserRight... userRights) { + public List getUserReferences(List regionUuids, List districtUuids, boolean activeOnly, UserRight... userRights) { - return getUserReferences(regionUuids, districtUuids, null, filterByCurrentUserJurisdiction, activeOnly, userRights); + return getUserReferences(regionUuids, districtUuids, null, activeOnly, userRights); } public List getUserReferences( List regionUuids, List districtUuids, List communityUuids, - boolean filterByJurisdiction, boolean activeOnly, UserRight... userRights) { - return getUserReferences(regionUuids, districtUuids, communityUuids, filterByJurisdiction, activeOnly, null, userRights); + return getUserReferences(regionUuids, districtUuids, communityUuids, activeOnly, null, userRights); } public List getUserReferences( List regionUuids, List districtUuids, List communityUuids, - boolean filterByJurisdiction, boolean activeOnly, Disease limitedDisease, UserRight... userRights) { - return getUserReferences( - regionUuids, - districtUuids, - communityUuids, - filterByJurisdiction, - activeOnly, - limitedDisease, - false, - Arrays.asList(userRights)); + return getUserReferences(regionUuids, districtUuids, communityUuids, activeOnly, limitedDisease, false, Arrays.asList(userRights)); } /** @@ -254,7 +239,6 @@ public List getUserReferences( List regionUuids, List districtUuids, List communityUuids, - boolean filterByJurisdiction, boolean activeOnly, Disease limitedDisease, boolean excludeLimitedDiseaseUsers, @@ -289,7 +273,7 @@ public List getUserReferences( filter = CriteriaBuilderHelper.and(cb, filter, districtFilter); userEntityJoinUsed = true; } - if (filterByJurisdiction) { + if (!hasRight(UserRight.SEE_PERSONAL_DATA_OUTSIDE_JURISDICTION)) { filter = CriteriaBuilderHelper.and(cb, filter, createCurrentUserJurisdictionFilter(cb, userRoot)); userEntityJoinUsed = true; } @@ -712,10 +696,6 @@ public Predicate createUserFilter(CriteriaBuilder cb, CriteriaQuery cq, From from) { - if (hasRight(UserRight.SEE_PERSONAL_DATA_OUTSIDE_JURISDICTION)) { - return cb.conjunction(); - } - User currentUser = getCurrentUser(); if (currentUser.getHealthFacility() != null) {