Skip to content

Commit

Permalink
#721 | Use targetGroup's uuid after accounting for Everyone Group dur…
Browse files Browse the repository at this point in the history
…ing groupPriv import
  • Loading branch information
himeshr committed Jul 18, 2024
1 parent 574fc4a commit 57f61c4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ public void savePrivileges(GroupPrivilegeContractWeb[] requests, Organisation or
List<Group> groups = groupRepository.findAll();

Arrays.stream(requests).filter(grpPrivyConWebRequest -> !grpPrivyConWebRequest.isVoided()).forEach(request -> {
Group targetedGroup = getGroup(request, organisation, groups);

This comment has been minimized.

Copy link
@mahalakshme

mahalakshme Jul 19, 2024

Contributor

@himeshr In getGroup we are checking only Everyone. It would be the same case for administrator group as well right? Looks like getGroup returns null as well - but that will not happen no? If it happens, it can lead to null pointer exception.

This comment has been minimized.

Copy link
@himeshr

himeshr Jul 19, 2024

Author Contributor

We do not support "Administrator" group during bundle upload, as mentioned in documentation.

GetGroup returning null is an issue with groups import. In general, we have basic assumption with bundle import that parent entities are created first, only after which children are attempted to be created.

This comment has been minimized.

Copy link
@mahalakshme

mahalakshme Jul 19, 2024

Contributor

Oh okay I didnt know that.

GroupPrivilege groupPrivilege = groupPrivileges.stream().filter(gp ->
Objects.equals(request.getGroupUUID(), gp.getGroupUuid())
Objects.equals(targetedGroup.getUuid(), gp.getGroupUuid())

This comment has been minimized.

Copy link
@mahalakshme

mahalakshme Jul 19, 2024

Contributor

@himeshr In getGroup we are checking only Everyone. It would be the same case for administrator group as well right? Looks like getGroup returns null as well - but that will not happen no? If it happens, it can lead to null pointer exception.

&& Objects.equals(request.getPrivilegeUUID(), gp.getPrivilegeUuid())
&& Objects.equals(request.getSubjectTypeUUID(), gp.getSubjectTypeUuid())
&& Objects.equals(request.getProgramUUID(), gp.getProgramUuid())
Expand All @@ -203,7 +204,7 @@ public void savePrivileges(GroupPrivilegeContractWeb[] requests, Organisation or
groupPrivilege.setEncounterType(CollectionUtil.findByUuid(encounterTypes, request.getEncounterTypeUUID()));
groupPrivilege.setProgramEncounterType(CollectionUtil.findByUuid(encounterTypes, request.getProgramEncounterTypeUUID()));
groupPrivilege.setChecklistDetail(CollectionUtil.findByUuid(checklistDetails, request.getChecklistDetailUUID()));
groupPrivilege.setGroup(getGroup(request, organisation, groups));
groupPrivilege.setGroup(targetedGroup);
}

groupPrivilege.setAllow(request.isAllow());
Expand Down

0 comments on commit 57f61c4

Please sign in to comment.