fix bug when creating user

This commit is contained in:
Hugo Renard 2022-03-23 15:21:33 +01:00
parent ce617daefd
commit 355e892525
Signed by: hougo
GPG key ID: 3A285FD470209C59

View file

@ -100,8 +100,12 @@ public class UserAdapter extends Adapter<UserModel, UserResource> {
user.getGroupsStream().flatMap(g -> g.getRoleMappingsStream()) user.getGroupsStream().flatMap(g -> g.getRoleMappingsStream())
.filter((r) -> r.getFirstAttribute("scim").equals("true")).map((r) -> r.getName()) .filter((r) -> r.getFirstAttribute("scim").equals("true")).map((r) -> r.getName())
.forEach(r -> rolesSet.add(r)); .forEach(r -> rolesSet.add(r));
// Bug when new user.
try {
user.getRoleMappingsStream().filter((r) -> r.getFirstAttribute("scim").equals("true")) user.getRoleMappingsStream().filter((r) -> r.getFirstAttribute("scim").equals("true"))
.map((r) -> r.getName()).forEach(r -> rolesSet.add(r)); .map((r) -> r.getName()).forEach(r -> rolesSet.add(r));
} catch (Exception e) {
}
var roles = new String[rolesSet.size()]; var roles = new String[rolesSet.size()];
rolesSet.toArray(roles); rolesSet.toArray(roles);
setRoles(roles); setRoles(roles);