Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ private boolean hasAccessToCancerStudy(
Arrays.stream(cancerStudy.getGroups().split(";"))
.filter(g -> !g.isEmpty())
.collect(Collectors.toSet());
if (!Collections.disjoint(groups, grantedAuthorities)) {
if (!caseInsensitiveDisjoint(groups, grantedAuthorities)) {
if (log.isDebugEnabled()) {
log.debug("hasAccessToCancerStudy(), user has access by groups return true");
}
Expand All @@ -393,6 +393,15 @@ private boolean hasAccessToCancerStudy(
return toReturn;
}

private static boolean caseInsensitiveDisjoint(Collection<String> c1, Collection<String> c2) {
if (c1 == null || c2 == null) {
return true; // If either collection is null, they are considered disjoint.
}
Set<String> upperC1 = c1.stream().filter(Objects::nonNull).map(String::toUpperCase).collect(Collectors.toSet());
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import for Objects class. Add import java.util.Objects; to the imports section to resolve the compilation error.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot statement incorrect. The import is contained in “import java.util.*;”.

Set<String> upperC2 = c2.stream().filter(Objects::nonNull).map(String::toUpperCase).collect(Collectors.toSet());
return Collections.disjoint(upperC1, upperC2);
}

private boolean hasAccessToCancerStudy(
Authentication authentication, String cancerStudyId, Object permission) {
// everybody has access the 'all' cancer study
Expand Down
Loading