From 627c466f7cc31582a2b9aa54f7ef91a8287fdd89 Mon Sep 17 00:00:00 2001 From: Alfred Schmid Date: Thu, 9 Jan 2014 13:42:54 +0100 Subject: [PATCH] Issue 356 - function updateUserModels also updates the stored teams in the UserModel. Now all Teammembers are shown when realm.ldap.synchronizeUsers.enable is turned on. --- src/main/java/com/gitblit/ConfigUserService.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gitblit/ConfigUserService.java b/src/main/java/com/gitblit/ConfigUserService.java index c1f0506d..19e4736a 100644 --- a/src/main/java/com/gitblit/ConfigUserService.java +++ b/src/main/java/com/gitblit/ConfigUserService.java @@ -216,18 +216,22 @@ public class ConfigUserService implements IUserService { // null check on "final" teams because JSON-sourced UserModel // can have a null teams object if (model.teams != null) { + Set userTeams = new HashSet(); for (TeamModel team : model.teams) { TeamModel t = teams.get(team.name.toLowerCase()); if (t == null) { // new team - team.addUser(model.username); - teams.put(team.name.toLowerCase(), team); - } else { - // do not clobber existing team definition - // maybe because this is a federated user - t.addUser(model.username); + t = team; + teams.put(team.name.toLowerCase(), t); } + // do not clobber existing team definition + // maybe because this is a federated user + t.addUser(model.username); + userTeams.add(t); } + // replace Team-Models in users by new ones. + model.teams.clear(); + model.teams.addAll(userTeams); // check for implicit team removal if (originalUser != null) { -- 2.39.5