Set<UserSpaceRole> allocated = new HashSet(usrs);
Set<Space> processed = new HashSet<Space>(usrs.size());
User user = usrs.get(0).getUser();
boolean isSuperUser = user.isSuperUser();
for(UserSpaceRole usr : usrs) {
Space space = usr.getSpace();
if(space == null || processed.contains(space)) {
continue;
}
processed.add(space);
for(String roleKey : space.getMetadata().getAllRoleKeys()) {
if(isSuperUser && Role.isAdmin(roleKey)) {
continue;
}
UserSpaceRole temp = new UserSpaceRole(user, space, roleKey);
if(!allocated.contains(temp)) {