From ce2a408256dcd81690f812dee95b0797e8880824 Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 11 Jul 2012 17:07:46 -0400 Subject: [PATCH] Fixed bug in ConfigUserService when user has nothing other than an account name --- src/com/gitblit/ConfigUserService.java | 6 ++++++ src/com/gitblit/Constants.java | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/com/gitblit/ConfigUserService.java b/src/com/gitblit/ConfigUserService.java index 66eb1760..9b0cf571 100644 --- a/src/com/gitblit/ConfigUserService.java +++ b/src/com/gitblit/ConfigUserService.java @@ -737,6 +737,12 @@ public class ConfigUserService implements IUserService { if (model.excludeFromFederation) { roles.add(Constants.NOT_FEDERATED_ROLE); } + if (roles.size() == 0) { + // we do this to ensure that user record with no password + // is written. otherwise, StoredConfig optimizes that account + // away. :( + roles.add(Constants.NO_ROLE); + } config.setStringList(USER, model.username, ROLE, roles); // repository memberships diff --git a/src/com/gitblit/Constants.java b/src/com/gitblit/Constants.java index b11505c0..772c768d 100644 --- a/src/com/gitblit/Constants.java +++ b/src/com/gitblit/Constants.java @@ -43,6 +43,8 @@ public class Constants { public static final String ADMIN_ROLE = "#admin"; public static final String NOT_FEDERATED_ROLE = "#notfederated"; + + public static final String NO_ROLE = "#none"; public static final String PROPERTIES_FILE = "gitblit.properties"; -- 2.39.5