Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java	(revision 28232)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java	(revision 28233)
@@ -912,6 +912,8 @@
 				HashMap<String, Serializable> responseParams = GSXML.extractParams(responseParamList, true);
 				String groups = (String) responseParams.get(GSXML.GROUPS_ATT);
+				String editEnabled = (String) responseParams.get("editEnabled");
 
 				userInformation.setAttribute(GSXML.GROUPS_ATT, groups);
+				userInformation.setAttribute("editEnabled", (editEnabled != null) ? editEnabled : "false");
 				xml_request.appendChild(userInformation);
 			}
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/Authentication.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/Authentication.java	(revision 28232)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/Authentication.java	(revision 28233)
@@ -127,4 +127,5 @@
 	protected static final String AUTHENTICATION_SERVICE = "Authentication";
 	protected static final String GET_USER_INFORMATION_SERVICE = "GetUserInformation";
+	protected static final String CHANGE_USER_EDIT_MODE_SERVICE = "ChangeUserEditMode";
 
 	protected static boolean _derbyWrapperDoneForcedShutdown = false;
@@ -171,5 +172,4 @@
 		this.short_service_info.appendChild(authentication_service);
 
-		// set up Authentication service info - for now just has name and type
 		Element getUserInformation_service = this.doc.createElement(GSXML.SERVICE_ELEM);
 		getUserInformation_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS);
@@ -177,6 +177,11 @@
 		this.short_service_info.appendChild(getUserInformation_service);
 
+		Element changeEditMode_service = this.doc.createElement(GSXML.SERVICE_ELEM);
+		changeEditMode_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS);
+		changeEditMode_service.setAttribute(GSXML.NAME_ATT, CHANGE_USER_EDIT_MODE_SERVICE);
+		this.short_service_info.appendChild(changeEditMode_service);
+
 		DerbyWrapper.createDatabaseIfNeeded();
-		
+
 		NodeList recaptchaElems = info.getElementsByTagName("recaptcha");
 		for (int i = 0; i < recaptchaElems.getLength(); i++)
@@ -217,4 +222,9 @@
 			authen_service.setAttribute(GSXML.NAME_ATT, GET_USER_INFORMATION_SERVICE);
 		}
+		else if (service_id.equals(CHANGE_USER_EDIT_MODE_SERVICE))
+		{
+			authen_service.setAttribute(GSXML.TYPE_ATT, GSXML.SERVICE_TYPE_PROCESS);
+			authen_service.setAttribute(GSXML.NAME_ATT, CHANGE_USER_EDIT_MODE_SERVICE);
+		}
 		else
 		{
@@ -245,9 +255,43 @@
 	}
 
-	protected Element processGetUserInformation(Element request)
+	protected Element processChangeUserEditMode(Element request)
 	{
 		// Create a new (empty) result message
 		Element result = this.doc.createElement(GSXML.RESPONSE_ELEM);
 
+		result.setAttribute(GSXML.FROM_ATT, CHANGE_USER_EDIT_MODE_SERVICE);
+		result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS);
+
+		Element paramList = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
+		if (paramList == null)
+		{
+			GSXML.addError(this.doc, result, _errorMessageMap.get(ERROR_REQUEST_HAS_NO_PARAM_LIST));
+			return result;
+		}
+
+		HashMap<String, Serializable> params = GSXML.extractParams(paramList, true);
+
+		String username = (String) params.get("username");
+		String editMode = (String) params.get("enabled");
+
+		if (!editMode.toLowerCase().equals("true") && !editMode.toLowerCase().equals("false"))
+		{
+			editMode = "false";
+		}
+
+		System.err.println("SETTING USER DATA -> " + username + " -> USER_EDIT_ENABLED -> " + editMode);
+
+		DerbyWrapper dw = openDatabase();
+		dw.addUserData(username, "USER_EDIT_ENABLED", editMode);
+		dw.closeDatabase();
+
+		return result;
+	}
+
+	protected Element processGetUserInformation(Element request)
+	{
+		// Create a new (empty) result message
+		Element result = this.doc.createElement(GSXML.RESPONSE_ELEM);
+
 		result.setAttribute(GSXML.FROM_ATT, GET_USER_INFORMATION_SERVICE);
 		result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS);
@@ -272,37 +316,36 @@
 		DerbyWrapper derbyWrapper = openDatabase();
 
-		try
-		{
-			UserQueryResult userQueryResult = derbyWrapper.findUser(username);
-
-			Vector<UserTermInfo> terms = userQueryResult.getUserTerms();
-
-			if (terms.size() == 0)
-			{
-				GSXML.addError(this.doc, result, _errorMessageMap.get(ERROR_REQUESTED_USER_NOT_FOUND));
-				return result;
-			}
-
-			UserTermInfo userInfo = terms.get(0);
-			Element userInfoList = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
-			result.appendChild(userInfoList);
-
-			Element usernameField = GSXML.createParameter(this.doc, "username", userInfo.username);
-			Element passwordField = GSXML.createParameter(this.doc, "password", userInfo.password);
-			Element groupsField = GSXML.createParameter(this.doc, "groups", userInfo.groups);
-			Element accountStatusField = GSXML.createParameter(this.doc, "accountstatus", userInfo.accountstatus);
-			Element commentField = GSXML.createParameter(this.doc, "comment", userInfo.comment);
-
-			userInfoList.appendChild(usernameField);
-			userInfoList.appendChild(passwordField);
-			userInfoList.appendChild(groupsField);
-			userInfoList.appendChild(accountStatusField);
-			userInfoList.appendChild(commentField);
-		}
-		catch (SQLException ex)
-		{
-			GSXML.addError(this.doc, result, _errorMessageMap.get(ERROR_SQL_EXCEPTION));
-			ex.printStackTrace();
-		}
+		UserQueryResult userQueryResult = derbyWrapper.findUser(username);
+		String editEnabled = derbyWrapper.getUserData(username, "USER_EDIT_ENABLED");
+
+		Vector<UserTermInfo> terms = userQueryResult.getUserTerms();
+
+		if (terms.size() == 0)
+		{
+			GSXML.addError(this.doc, result, _errorMessageMap.get(ERROR_REQUESTED_USER_NOT_FOUND));
+			return result;
+		}
+
+		UserTermInfo userInfo = terms.get(0);
+		Element userInfoList = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
+		result.appendChild(userInfoList);
+
+		Element usernameField = GSXML.createParameter(this.doc, "username", userInfo.username);
+		Element passwordField = GSXML.createParameter(this.doc, "password", userInfo.password);
+		Element groupsField = GSXML.createParameter(this.doc, "groups", userInfo.groups);
+		Element accountStatusField = GSXML.createParameter(this.doc, "accountstatus", userInfo.accountstatus);
+		Element commentField = GSXML.createParameter(this.doc, "comment", userInfo.comment);
+
+		if (editEnabled != null)
+		{
+			Element editEnabledElem = GSXML.createParameter(this.doc, "editEnabled", editEnabled);
+			userInfoList.appendChild(editEnabledElem);
+		}
+
+		userInfoList.appendChild(usernameField);
+		userInfoList.appendChild(passwordField);
+		userInfoList.appendChild(groupsField);
+		userInfoList.appendChild(accountStatusField);
+		userInfoList.appendChild(commentField);
 
 		derbyWrapper.closeDatabase();
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java	(revision 28232)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java	(revision 28233)
@@ -335,8 +335,8 @@
 		try
 		{
+			System.err.println("xx" + conn.isClosed());
 			Statement state = conn.createStatement();
 			ResultSet rs = state.executeQuery("SELECT * FROM " + DATA + " WHERE username='" + username + "' AND name='" + name + "'");
 			conn.commit();
-			state.close();
 			if (rs.next())
 			{
@@ -347,4 +347,5 @@
 				found = false;
 			}
+			state.close();
 		}
 		catch (Exception ex)
@@ -354,4 +355,5 @@
 			{
 				printSQLError((SQLException) ex);
+				ex.printStackTrace();
 			}
 			else
@@ -411,9 +413,9 @@
 			ResultSet rs = state.executeQuery("SELECT * FROM " + DATA + " WHERE username='" + username + "' AND name='" + name + "'");
 			conn.commit();
-			state.close();
 			if (rs.next())
 			{
 				return rs.getString("value");
 			}
+			state.close();
 		}
 		catch (Exception ex)
@@ -423,4 +425,5 @@
 			{
 				printSQLError((SQLException) ex);
+				ex.printStackTrace();
 			}
 			else
@@ -607,5 +610,5 @@
 	// findUser(null) will return all users, which is why a UserQueryResult 
 	// (a vector of UserTermInfo) is returned
-	public UserQueryResult findUser(String username) throws SQLException
+	public UserQueryResult findUser(String username)
 	{
 		UserQueryResult userQueryResult = new UserQueryResult();
@@ -625,39 +628,46 @@
 		ArrayList<HashMap<String, String>> users = new ArrayList<HashMap<String, String>>();
 
-		Statement state = conn.createStatement();
-		ResultSet rs = state.executeQuery(sql_find_user);
-		conn.commit();
-		while (rs.next())
-		{
-			HashMap<String, String> user = new HashMap<String, String>();
-			user.put("username", rs.getString("username"));
-			user.put("password", rs.getString("password"));
-			user.put("as", rs.getString("accountstatus"));
-			user.put("comment", rs.getString("comment"));
-			user.put("email", rs.getString("email"));
-
-			users.add(user);
-		}
-		state.close();
-
-		state = conn.createStatement();
-		for (HashMap<String, String> user : users)
-		{
-			ResultSet gs = state.executeQuery("SELECT role FROM " + ROLES + " WHERE username = '" + user.get("username") + "'");
-			conn.commit();
-
-			String group = "";
-			while (gs.next())
-			{
-				if (!group.equals(""))
+		try
+		{
+			Statement state = conn.createStatement();
+			ResultSet rs = state.executeQuery(sql_find_user);
+			conn.commit();
+			while (rs.next())
+			{
+				HashMap<String, String> user = new HashMap<String, String>();
+				user.put("username", rs.getString("username"));
+				user.put("password", rs.getString("password"));
+				user.put("as", rs.getString("accountstatus"));
+				user.put("comment", rs.getString("comment"));
+				user.put("email", rs.getString("email"));
+
+				users.add(user);
+			}
+			state.close();
+
+			state = conn.createStatement();
+			for (HashMap<String, String> user : users)
+			{
+				ResultSet gs = state.executeQuery("SELECT role FROM " + ROLES + " WHERE username = '" + user.get("username") + "'");
+				conn.commit();
+
+				String group = "";
+				while (gs.next())
 				{
-					group += ",";
+					if (!group.equals(""))
+					{
+						group += ",";
+					}
+					group += gs.getString("role");
 				}
-				group += gs.getString("role");
-			}
-
-			userQueryResult.addUserTerm(user.get("username"), user.get("password"), group, user.get("as"), user.get("comment"), user.get("email"));
-		}
-		state.close();
+
+				userQueryResult.addUserTerm(user.get("username"), user.get("password"), group, user.get("as"), user.get("comment"), user.get("email"));
+			}
+			state.close();
+		}
+		catch (Exception ex)
+		{
+			ex.printStackTrace();
+		}
 
 		if (userQueryResult.getSize() > 0)
