From 679f2bd6e09afe117e9b30fedcf0d351fefaecd5 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 06 Jan 2012 17:21:13 -0500
Subject: [PATCH] Updated Express documentation

---
 src/com/gitblit/GitBlit.java |   47 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java
index d82e3c2..ce3e16d 100644
--- a/src/com/gitblit/GitBlit.java
+++ b/src/com/gitblit/GitBlit.java
@@ -75,6 +75,7 @@
 import com.gitblit.models.SettingModel;
 import com.gitblit.models.TeamModel;
 import com.gitblit.models.UserModel;
+import com.gitblit.utils.ArrayUtils;
 import com.gitblit.utils.ByteFormat;
 import com.gitblit.utils.FederationUtils;
 import com.gitblit.utils.JGitUtils;
@@ -449,8 +450,18 @@
 	 */
 	public List<String> getAllUsernames() {
 		List<String> names = new ArrayList<String>(userService.getAllUsernames());
-		Collections.sort(names);
 		return names;
+	}
+
+	/**
+	 * Returns the list of all users available to the login service.
+	 * 
+	 * @see IUserService.getAllUsernames()
+	 * @return list of all usernames
+	 */
+	public List<UserModel> getAllUsers() {
+		List<UserModel> users = userService.getAllUsers();
+		return users;
 	}
 
 	/**
@@ -533,7 +544,17 @@
 	 */
 	public List<String> getAllTeamnames() {
 		List<String> teams = new ArrayList<String>(userService.getAllTeamNames());
-		Collections.sort(teams);
+		return teams;
+	}
+
+	/**
+	 * Returns the list of available teams that a user or repository may be
+	 * assigned to.
+	 * 
+	 * @return the list of teams
+	 */
+	public List<TeamModel> getAllTeams() {
+		List<TeamModel> teams = userService.getAllTeams();
 		return teams;
 	}
 
@@ -971,14 +992,14 @@
 		config.setString("gitblit", null, "federationStrategy",
 				repository.federationStrategy.name());
 		config.setBoolean("gitblit", null, "isFederated", repository.isFederated);
-		if (repository.preReceiveScripts != null) {
+		if (!ArrayUtils.isEmpty(repository.preReceiveScripts)) {
 			config.setStringList("gitblit", null, "preReceiveScript", repository.preReceiveScripts);
 		}
-		if (repository.postReceiveScripts != null) {
+		if (!ArrayUtils.isEmpty(repository.postReceiveScripts)) {
 			config.setStringList("gitblit", null, "postReceiveScript",
 					repository.postReceiveScripts);
 		}
-		if (repository.mailingLists != null) {
+		if (!ArrayUtils.isEmpty(repository.mailingLists)) {
 			config.setStringList("gitblit", null, "mailingList", repository.mailingLists);
 		}
 		try {
@@ -1233,6 +1254,7 @@
 		case PULL_TEAMS:
 			return token.equals(all) || token.equals(unr);
 		case PULL_SETTINGS:
+		case PULL_SCRIPTS:
 			return token.equals(all);
 		}
 		return false;
@@ -1766,6 +1788,21 @@
 				webxmlSettings.applyOverrides(overrideFile);
 			}
 			configureContext(webxmlSettings, true);
+
+			// Copy the included scripts to the configured groovy folder
+			File localScripts = getFileOrFolder(Keys.groovy.scriptsFolder, "groovy");
+			if (!localScripts.exists()) {
+				File includedScripts = new File(context.getRealPath("/WEB-INF/groovy"));
+				if (!includedScripts.equals(localScripts)) {
+					try {
+						com.gitblit.utils.FileUtils.copy(localScripts, includedScripts.listFiles());
+					} catch (IOException e) {
+						logger.error(MessageFormat.format(
+								"Failed to copy included Groovy scripts from {0} to {1}",
+								includedScripts, localScripts));
+					}
+				}
+			}
 		}
 
 		serverStatus.servletContainer = servletContext.getServerInfo();

--
Gitblit v1.9.1