[DS-3463] Fix IP authentication for anonymous users

Added group membership check based on context even if no eperson is found. Affects file downloads in (at least) xmlui.
This commit is contained in:
Miika Nurminen
2017-02-23 08:20:44 +02:00
parent 5a26f17a3d
commit 314dddafc7

View File

@@ -185,6 +185,15 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
//lookup eperson in normal groups and subgroups //lookup eperson in normal groups and subgroups
return epersonInGroup(context, groupName, currentUser); return epersonInGroup(context, groupName, currentUser);
} else { } else {
// Check also for anonymous users if IP authentication used
List<Group> specialGroups = context.getSpecialGroups();
if(CollectionUtils.isNotEmpty(specialGroups)) {
for(Group specialGroup : specialGroups){
if (StringUtils.equals(specialGroup.getName(), groupName)) {
return true;
}
}
}
return false; return false;
} }
} }