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