SEBSERV-65 minor fix

This commit is contained in:
anhefti 2019-06-27 12:47:43 +02:00
parent 37e75207b1
commit 8d9cf58e69

View file

@ -10,6 +10,7 @@ package ch.ethz.seb.sebserver.gbl.model.user;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -184,10 +185,14 @@ public final class UserMod implements UserAccount {
@Override @Override
@JsonIgnore @JsonIgnore
public EnumSet<UserRole> getUserRoles() { public EnumSet<UserRole> getUserRoles() {
return EnumSet.copyOf( final List<UserRole> roles = getRoles()
getRoles().stream() .stream()
.map(r -> UserRole.valueOf(r)) .map(r -> UserRole.valueOf(r))
.collect(Collectors.toList())); .collect(Collectors.toList());
if (roles.isEmpty()) {
return EnumSet.noneOf(UserRole.class);
}
return EnumSet.copyOf(roles);
} }
public String getRetypedNewPassword() { public String getRetypedNewPassword() {