diff options
author | Alfred Schmid <A.Schmid@ff-muenchen.de> | 2014-01-09 13:42:54 +0100 |
---|---|---|
committer | Alfred Schmid <A.Schmid@ff-muenchen.de> | 2014-01-09 13:42:54 +0100 |
commit | 627c466f7cc31582a2b9aa54f7ef91a8287fdd89 (patch) | |
tree | 0be31a3020884bf98378e31bd74746f1da21cd05 /src/main/java/com/gitblit | |
parent | 814e248354ed9b234c59e3470ef363f705bf711a (diff) | |
download | gitblit-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/java/com/gitblit')
-rw-r--r-- | src/main/java/com/gitblit/ConfigUserService.java | 16 |
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) {
|