Merge pull request #1415 from KevinVdV/DS-3185-fix-special-group-rights

[DS-3185] Special group doesn't grant the right to submit
This commit is contained in:
Pascal-Nicolas Becker
2016-05-26 15:21:16 +02:00

View File

@@ -171,22 +171,19 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
EPerson currentUser = context.getCurrentUser();
//First check the special groups
boolean found = false;
List<Group> specialGroups = context.getSpecialGroups();
if(CollectionUtils.isNotEmpty(specialGroups)) {
Iterator<Group> it = specialGroups.iterator();
while (it.hasNext() && !found) {
Group next = it.next();
found = StringUtils.equals(next.getName(), groupName);
for (Group specialGroup : specialGroups)
{
//Check if the current special group is the one we are looking for OR retrieve all groups & make a check here.
if(StringUtils.equals(specialGroup.getName(), groupName) || allMemberGroups(context, currentUser).contains(findByName(context, groupName)))
{
return true;
}
}
}
if(found) {
return true;
} else {
//lookup eperson in normal groups and subgroups
return epersonInGroup(context, groupName, currentUser);
}
//lookup eperson in normal groups and subgroups
return epersonInGroup(context, groupName, currentUser);
} else {
return false;
}