Skip to content

Commit 1dda945

Browse files
committed
Merge pull request gitblit-org#131 from alfsch/master
Fix for Issue 356 - LDAP Groupmembers are not displayed until they are signed in once
2 parents 814e248 + 627c466 commit 1dda945

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/main/java/com/gitblit/ConfigUserService.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,22 @@ public synchronized boolean updateUserModels(Collection<UserModel> models) {
216216
// null check on "final" teams because JSON-sourced UserModel
217217
// can have a null teams object
218218
if (model.teams != null) {
219+
Set<TeamModel> userTeams = new HashSet<TeamModel>();
219220
for (TeamModel team : model.teams) {
220221
TeamModel t = teams.get(team.name.toLowerCase());
221222
if (t == null) {
222223
// new team
223-
team.addUser(model.username);
224-
teams.put(team.name.toLowerCase(), team);
225-
} else {
226-
// do not clobber existing team definition
227-
// maybe because this is a federated user
228-
t.addUser(model.username);
224+
t = team;
225+
teams.put(team.name.toLowerCase(), t);
229226
}
227+
// do not clobber existing team definition
228+
// maybe because this is a federated user
229+
t.addUser(model.username);
230+
userTeams.add(t);
230231
}
232+
// replace Team-Models in users by new ones.
233+
model.teams.clear();
234+
model.teams.addAll(userTeams);
231235

232236
// check for implicit team removal
233237
if (originalUser != null) {

0 commit comments

Comments
 (0)