protected void readProfilesConf() {
    userMapping.clear();

    File file = new File("profiles.conf");
    String content = FileHelper.getFileContentAsString(file);

    JSONArray json = new JSONArray(content);
    StructuredDataArray sda = StructuredDataHelper.fromJSONArray(json).toStructuredDataArray();

    for (Object object : sda) {
      if (!(object instanceof StructuredDataObject)) continue;

      StructuredDataObject sdo = (StructuredDataObject) object;
      String name = sdo.getString("name");
      String confName = sdo.getString("conf");

      if (hasSuchProfile(name)) userMapping.put(name, confName);
    }
  }
  protected void writeMappings() {
    StructuredDataArray sda = new StructuredDataArray();

    for (String profile : userMapping.keySet()) {
      if (!hasSuchProfile(profile)) continue;

      String conf = userMapping.get(profile);
      if (!GuiManager.mainWindow.getPanelManageUsers().hasConfWithName(conf)) continue;

      StructuredDataObject sdo = new StructuredDataObject();
      sdo.put("name", profile);
      sdo.put("conf", conf);

      sda.put(sdo);
    }

    File file = new File("profiles.conf");
    FileHelper.writeToFile(file, StructuredDataHelper.toJSONArray(sda).toString());
  }
 protected void writeDefaultProfilesConfFile() {
   File file = new File("profiles.conf");
   FileHelper.writeToFile(file, "[]");
 }