Updated whitelist handling to save users when created. Also, added

default test user for habridge UI. Made change state to be validated
against whitelist.
This commit is contained in:
Admin
2017-03-13 16:37:42 -05:00
parent d15a1c58d0
commit fb24e9d1a3
8 changed files with 167 additions and 122 deletions

View File

@@ -154,6 +154,8 @@ public class BridgeSettings extends BackupHandler {
if(serverIpOverride != null)
theBridgeSettings.setWebaddress(serverIpOverride);
setupParams(Paths.get(theBridgeSettings.getConfigfile()), ".cfgbk", "habridge.config-");
setupInternalTestUser();
}
public void loadConfig() {
@@ -188,6 +190,16 @@ public class BridgeSettings extends BackupHandler {
}
public void updateConfigFile() {
log.debug("Save HA Bridge settings.");
Path configPath = Paths.get(theBridgeSettings.getConfigfile());
JsonTransformer aRenderer = new JsonTransformer();
String jsonValue = aRenderer.render(theBridgeSettings);
configWriter(jsonValue, configPath);
_loadConfig(configPath);
}
private void configWriter(String content, Path filePath) {
if(Files.exists(filePath) && !Files.isWritable(filePath)){
log.error("Error file is not writable: " + filePath);
@@ -279,4 +291,9 @@ public class BridgeSettings extends BackupHandler {
}
return addressString;
}
private void setupInternalTestUser() {
theBridgeSettings.setupInternalTestUser();
if(theBridgeSettings.isSettingsChanged())
this.updateConfigFile();
}
}