File tree 1 file changed +10
-6
lines changed
src/main/java/com/gitblit
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -216,18 +216,22 @@ public synchronized boolean updateUserModels(Collection<UserModel> models) {
216
216
// null check on "final" teams because JSON-sourced UserModel
217
217
// can have a null teams object
218
218
if (model .teams != null ) {
219
+ Set <TeamModel > userTeams = new HashSet <TeamModel >();
219
220
for (TeamModel team : model .teams ) {
220
221
TeamModel t = teams .get (team .name .toLowerCase ());
221
222
if (t == null ) {
222
223
// 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 );
229
226
}
227
+ // do not clobber existing team definition
228
+ // maybe because this is a federated user
229
+ t .addUser (model .username );
230
+ userTeams .add (t );
230
231
}
232
+ // replace Team-Models in users by new ones.
233
+ model .teams .clear ();
234
+ model .teams .addAll (userTeams );
231
235
232
236
// check for implicit team removal
233
237
if (originalUser != null ) {
You can’t perform that action at this time.
0 commit comments