Skip to content

Commit 57f61c4

Browse files
committed
#721 | Use targetGroup's uuid after accounting for Everyone Group during groupPriv import
1 parent 574fc4a commit 57f61c4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

avni-server-api/src/main/java/org/avni/server/service/accessControl/GroupPrivilegeService.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,9 @@ public void savePrivileges(GroupPrivilegeContractWeb[] requests, Organisation or
184184
List<Group> groups = groupRepository.findAll();
185185

186186
Arrays.stream(requests).filter(grpPrivyConWebRequest -> !grpPrivyConWebRequest.isVoided()).forEach(request -> {
187+
Group targetedGroup = getGroup(request, organisation, groups);
187188
GroupPrivilege groupPrivilege = groupPrivileges.stream().filter(gp ->
188-
Objects.equals(request.getGroupUUID(), gp.getGroupUuid())
189+
Objects.equals(targetedGroup.getUuid(), gp.getGroupUuid())
189190
&& Objects.equals(request.getPrivilegeUUID(), gp.getPrivilegeUuid())
190191
&& Objects.equals(request.getSubjectTypeUUID(), gp.getSubjectTypeUuid())
191192
&& Objects.equals(request.getProgramUUID(), gp.getProgramUuid())
@@ -203,7 +204,7 @@ public void savePrivileges(GroupPrivilegeContractWeb[] requests, Organisation or
203204
groupPrivilege.setEncounterType(CollectionUtil.findByUuid(encounterTypes, request.getEncounterTypeUUID()));
204205
groupPrivilege.setProgramEncounterType(CollectionUtil.findByUuid(encounterTypes, request.getProgramEncounterTypeUUID()));
205206
groupPrivilege.setChecklistDetail(CollectionUtil.findByUuid(checklistDetails, request.getChecklistDetailUUID()));
206-
groupPrivilege.setGroup(getGroup(request, organisation, groups));
207+
groupPrivilege.setGroup(targetedGroup);
207208
}
208209

209210
groupPrivilege.setAllow(request.isAllow());

0 commit comments

Comments
 (0)