Skip to content
Closed
Changes from 2 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,12 @@ private boolean hasAccessToCancerStudy(
return toReturn;
}

private static boolean caseInsensitiveDisjoint(Collection<String> c1, Collection<String> c2) {
Comment thread
alisman marked this conversation as resolved.
Set<String> upperC1 = c1.stream().map(String::toUpperCase).collect(Collectors.toSet());
Set<String> upperC2 = c2.stream().map(String::toUpperCase).collect(Collectors.toSet());
Comment thread
alisman marked this conversation as resolved.
Outdated
Comment thread
alisman marked this conversation as resolved.
Outdated
return Collections.disjoint(upperC1, upperC2);
}

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