summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/gitblit')
-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) {