Commit 593ce0be authored by Tom Evans's avatar Tom Evans

OF-800: Fix handling for system properties page

Properly detect and modify encryption settings from the system
properties page. Remove encryption settings for deleted properties.
parent acc93e0d
...@@ -765,6 +765,7 @@ public class JiveGlobals { ...@@ -765,6 +765,7 @@ public class JiveGlobals {
properties = JiveProperties.getInstance(); properties = JiveProperties.getInstance();
} }
properties.remove(name); properties.remove(name);
setPropertyEncrypted(name, false);
} }
/** /**
...@@ -825,10 +826,10 @@ public class JiveGlobals { ...@@ -825,10 +826,10 @@ public class JiveGlobals {
loadSecurityProperties(); loadSecurityProperties();
} }
boolean propertyWasChanged; boolean propertyWasChanged;
if (isPropertyEncrypted(name)) { if (encrypt) {
propertyWasChanged = securityProperties.removeFromList(ENCRYPTED_PROPERTY_NAMES, name);
} else {
propertyWasChanged = securityProperties.addToList(ENCRYPTED_PROPERTY_NAMES, name); propertyWasChanged = securityProperties.addToList(ENCRYPTED_PROPERTY_NAMES, name);
} else {
propertyWasChanged = securityProperties.removeFromList(ENCRYPTED_PROPERTY_NAMES, name);
} }
if (propertyWasChanged) { if (propertyWasChanged) {
resetProperty(name); resetProperty(name);
......
...@@ -684,6 +684,7 @@ public class XMLProperties { ...@@ -684,6 +684,7 @@ public class XMLProperties {
// .. then write to disk. // .. then write to disk.
saveProperties(); saveProperties();
JiveGlobals.setPropertyEncrypted(name, false);
// Generate event. // Generate event.
Map<String, Object> params = Collections.emptyMap(); Map<String, Object> params = Collections.emptyMap();
PropertyEventDispatcher.dispatchEvent(name, PropertyEventDispatcher.EventType.xml_property_deleted, params); PropertyEventDispatcher.dispatchEvent(name, PropertyEventDispatcher.EventType.xml_property_deleted, params);
......
...@@ -82,16 +82,6 @@ ...@@ -82,16 +82,6 @@
} }
} }
if (encrypt) {
if (propName != null) {
JiveGlobals.setPropertyEncrypted(propName, true);
// Log the event
webManager.logEvent("encrypted server property "+propName, null);
response.sendRedirect("server-properties.jsp?encryptsuccess=true");
return;
}
}
Map<String, String> errors = new HashMap<String, String>(); Map<String, String> errors = new HashMap<String, String>();
if (save) { if (save) {
if (propName == null || "".equals(propName.trim()) || propName.startsWith("\"")) { if (propName == null || "".equals(propName.trim()) || propName.startsWith("\"")) {
...@@ -113,16 +103,26 @@ ...@@ -113,16 +103,26 @@
} }
} }
if (encrypt) {
if (propName != null) {
JiveGlobals.setPropertyEncrypted(propName, true);
// Log the event
webManager.logEvent("encrypted server property "+propName, null);
response.sendRedirect("server-properties.jsp?encryptsuccess=true");
return;
}
}
if (edit) {
propValue = JiveGlobals.getProperty(propName);
}
List<String> properties = JiveGlobals.getPropertyNames(); List<String> properties = JiveGlobals.getPropertyNames();
Collections.sort(properties, new Comparator<String>() { Collections.sort(properties, new Comparator<String>() {
public int compare(String s1, String s2) { public int compare(String s1, String s2) {
return s1.toLowerCase().compareTo(s2.toLowerCase()); return s1.toLowerCase().compareTo(s2.toLowerCase());
} }
}); });
if (edit) {
propValue = JiveGlobals.getProperty(propName);
}
%> %>
<html> <html>
...@@ -426,10 +426,5 @@ function dodelete(propName) { ...@@ -426,10 +426,5 @@ function dodelete(propName) {
</form> </form>
<br><br><br><br><br><br>
<br><br><br><br><br><br>
<br><br><br><br><br><br>
<br><br><br><br><br><br>
</body> </body>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment