From f76fee63ed9cb3a30d3c0c092d860b1cb93a481b Mon Sep 17 00:00:00 2001 From: Gerard Smyth <gerard.smyth@gmail.com> Date: Thu, 08 May 2014 13:09:30 -0400 Subject: [PATCH] Updated the SyndicationServlet to provide an additional option to return details of the tags in the repository instead of the commits. This uses a new 'ot' request parameter to indicate the object type of the content to return, which can be ither TAG or COMMIT. If this is not provided, then COMMIT is assumed to maintain backwards compatability. If tags are returned, then the paging parameters, 'l' and 'pg' are still supported, but searching options are currently ignored. --- src/main/java/com/gitblit/ConfigUserService.java | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gitblit/ConfigUserService.java b/src/main/java/com/gitblit/ConfigUserService.java index e865225..9b4dd7f 100644 --- a/src/main/java/com/gitblit/ConfigUserService.java +++ b/src/main/java/com/gitblit/ConfigUserService.java @@ -98,6 +98,8 @@ private static final String ACCOUNTTYPE = "accountType"; + private static final String DISABLED = "disabled"; + private final File realmFile; private final Logger logger = LoggerFactory.getLogger(ConfigUserService.class); @@ -133,7 +135,7 @@ * @return cookie value */ @Override - public String getCookie(UserModel model) { + public synchronized String getCookie(UserModel model) { if (!StringUtils.isEmpty(model.cookie)) { return model.cookie; } @@ -195,7 +197,7 @@ * @return true if update is successful */ @Override - public boolean updateUserModel(UserModel model) { + public synchronized boolean updateUserModel(UserModel model) { return updateUserModel(model.username, model); } @@ -325,7 +327,7 @@ * @return true if successful */ @Override - public boolean deleteUserModel(UserModel model) { + public synchronized boolean deleteUserModel(UserModel model) { return deleteUser(model.username); } @@ -372,7 +374,7 @@ * @since 0.8.0 */ @Override - public List<String> getAllTeamNames() { + public synchronized List<String> getAllTeamNames() { read(); List<String> list = new ArrayList<String>(teams.keySet()); Collections.sort(list); @@ -447,7 +449,7 @@ * @since 0.8.0 */ @Override - public boolean updateTeamModel(TeamModel model) { + public synchronized boolean updateTeamModel(TeamModel model) { return updateTeamModel(model.name, model); } @@ -459,7 +461,7 @@ * @since 1.2.0 */ @Override - public boolean updateTeamModels(Collection<TeamModel> models) { + public synchronized boolean updateTeamModels(Collection<TeamModel> models) { try { read(); for (TeamModel team : models) { @@ -485,7 +487,7 @@ * @since 0.8.0 */ @Override - public boolean updateTeamModel(String teamname, TeamModel model) { + public synchronized boolean updateTeamModel(String teamname, TeamModel model) { TeamModel original = null; try { read(); @@ -514,7 +516,7 @@ * @since 0.8.0 */ @Override - public boolean deleteTeamModel(TeamModel model) { + public synchronized boolean deleteTeamModel(TeamModel model) { return deleteTeam(model.name); } @@ -526,7 +528,7 @@ * @since 0.8.0 */ @Override - public boolean deleteTeam(String teamname) { + public synchronized boolean deleteTeam(String teamname) { try { // Read realm file read(); @@ -545,7 +547,7 @@ * @return list of all usernames */ @Override - public List<String> getAllUsernames() { + public synchronized List<String> getAllUsernames() { read(); List<String> list = new ArrayList<String>(users.keySet()); Collections.sort(list); @@ -700,6 +702,9 @@ } if (!StringUtils.isEmpty(model.countryCode)) { config.setString(USER, model.username, COUNTRYCODE, model.countryCode); + } + if (model.disabled) { + config.setBoolean(USER, model.username, DISABLED, true); } if (model.getPreferences() != null) { if (!StringUtils.isEmpty(model.getPreferences().locale)) { @@ -868,6 +873,7 @@ if (Constants.EXTERNAL_ACCOUNT.equals(user.password) && user.accountType.isLocal()) { user.accountType = AccountType.EXTERNAL; } + user.disabled = config.getBoolean(USER, username, DISABLED, false); user.organizationalUnit = config.getString(USER, username, ORGANIZATIONALUNIT); user.organization = config.getString(USER, username, ORGANIZATION); user.locality = config.getString(USER, username, LOCALITY); -- Gitblit v1.9.1