summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorAlfred Schmid <A.Schmid@ff-muenchen.de>2014-01-09 13:42:54 +0100
committerAlfred Schmid <A.Schmid@ff-muenchen.de>2014-01-09 13:42:54 +0100
commit627c466f7cc31582a2b9aa54f7ef91a8287fdd89 (patch)
tree0be31a3020884bf98378e31bd74746f1da21cd05 /src/main
parent814e248354ed9b234c59e3470ef363f705bf711a (diff)
downloadgitblit-627c466f7cc31582a2b9aa54f7ef91a8287fdd89.tar.gz
gitblit-627c466f7cc31582a2b9aa54f7ef91a8287fdd89.zip
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.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/gitblit/ConfigUserService.java16
1 files 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<TeamModel> userTeams = new HashSet<TeamModel>();
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) {