Skip to content

Commit c8ba7c8

Browse files
committed
Allow disable telemetry from BrandingConstants
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
1 parent ea04b1e commit c8ba7c8

File tree

7 files changed

+38
-15
lines changed

7 files changed

+38
-15
lines changed

client/src/com/mirth/connect/client/ui/BrandingConstants.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,8 @@ public class BrandingConstants {
4040
// These images must be at 215px x 30px scale
4141
public static final ImageIcon LOGO = new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/branding/oie_logo_banner_text_215x30.png"));
4242
public static final ImageIcon LOGO_GRAY = new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/branding/oie_white_logo_banner_text_215x30.png"));
43+
44+
public static final boolean CENTRAL_USER_REGISTRATION = true;
45+
public static final boolean CHECK_FOR_NOTIFICATIONS = true;
46+
public static final boolean SEND_USAGE_STATISTICS = true;
4347
}

client/src/com/mirth/connect/client/ui/FirstLoginDialog.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,17 @@ public FirstLoginDialog(User currentUser) {
4848

4949
userEditPanel.setUser(this, currentUser);
5050
userEditPanel.setRequiredFields(false, true);
51-
if (currentUser.getId() == 1) {
51+
if (BrandingConstants.CENTRAL_USER_REGISTRATION) {
52+
if (currentUser.getId() == 1) {
53+
// When CENTRAL_USER_REGISTRATION is set, registration is compulsatory
54+
// for the first user of the system.
55+
registerCheckBox.setVisible(false);
56+
}
57+
} else {
5258
registerCheckBox.setVisible(false);
59+
registerCheckBox.setSelected(false);
60+
userConsentCheckBox.setVisible(false);
61+
userConsentCheckBox.setSelected(false);
5362
}
5463

5564
jLabel2.setForeground(UIConstants.HEADER_TITLE_TEXT_COLOR);
@@ -273,7 +282,7 @@ private void finishButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
273282
return;
274283
}
275284

276-
if (registerCheckBox.isSelected()) {
285+
if (registerCheckBox.isSelected() && BrandingConstants.CENTRAL_USER_REGISTRATION) {
277286
parent.registerUser(user);
278287
}
279288

client/src/com/mirth/connect/client/ui/Frame.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,9 @@ private void createOtherPane() {
12501250
otherPane.setTitle("Other");
12511251
otherPane.setName(TaskConstants.OTHER_KEY);
12521252
otherPane.setFocusable(false);
1253-
addTask(TaskConstants.OTHER_NOTIFICATIONS, UIConstants.VIEW_NOTIFICATIONS, String.format("View notifications from %s.", BrandingConstants.PRODUCT_NAME), "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/flag_orange.png")), otherPane, null);
1253+
if (BrandingConstants.CHECK_FOR_NOTIFICATIONS) {
1254+
addTask(TaskConstants.OTHER_NOTIFICATIONS, UIConstants.VIEW_NOTIFICATIONS, String.format("View notifications from %s.", BrandingConstants.PRODUCT_NAME), "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/flag_orange.png")), otherPane, null);
1255+
}
12541256
addTask(TaskConstants.OTHER_VIEW_USER_API, "View User API", String.format("View documentation for the %s User API.", BrandingConstants.PRODUCT_NAME), "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/page_white_text.png")), otherPane, null);
12551257
addTask(TaskConstants.OTHER_VIEW_CLIENT_API, "View Client API", String.format("View documentation for the %s Client API.", BrandingConstants.PRODUCT_NAME), "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/page_white_text.png")), otherPane, null);
12561258
addTask(TaskConstants.OTHER_HELP, "Help", String.format("View help for %s.", BrandingConstants.PRODUCT_NAME), "", new ImageIcon(com.mirth.connect.client.ui.Frame.class.getResource("images/help.png")), otherPane, null);
@@ -1972,6 +1974,10 @@ public void done() {
19721974
}
19731975

19741976
public void sendUsageStatistics() {
1977+
if (!BrandingConstants.SEND_USAGE_STATISTICS) {
1978+
return;
1979+
}
1980+
19751981
UpdateSettings updateSettings = null;
19761982
try {
19771983
updateSettings = mirthClient.getUpdateSettings();

client/src/com/mirth/connect/client/ui/LoginPanel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,8 @@ private boolean handleSuccess(LoginStatus loginStatus) throws ClientException {
609609

610610
// Check for new notifications from update server if enabled
611611
String checkForNotifications = userPreferences.getProperty("checkForNotifications");
612-
if (checkForNotifications == null || BooleanUtils.toBoolean(checkForNotifications)) {
612+
if (BrandingConstants.CHECK_FOR_NOTIFICATIONS
613+
&& (checkForNotifications == null || BooleanUtils.toBoolean(checkForNotifications))) {
613614
Set<Integer> archivedNotifications = new HashSet<Integer>();
614615
String archivedNotificationString = userPreferences.getProperty("archivedNotifications");
615616
if (archivedNotificationString != null) {

server/src/com/mirth/connect/client/core/BrandingConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ public class BrandingConstants {
99
public static final String CLIENT_CONNECTION_HEADER = "openintegrationengine-client";
1010

1111
public static final String SERVER_CERTIFICATE_CN = "oie-engine";
12+
13+
public static final String CONNECT_SERVER_URL = "https://connect.openintegrationengine.org";
14+
public static final boolean SEND_USAGE_STATISTICS = true;
1215
}

server/src/com/mirth/connect/client/core/ConnectServiceUtil.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@
4242
import com.fasterxml.jackson.core.type.TypeReference;
4343
import com.fasterxml.jackson.databind.JsonNode;
4444
import com.fasterxml.jackson.databind.ObjectMapper;
45+
import com.mirth.connect.client.core.BrandingConstants;
4546
import com.mirth.connect.model.User;
4647
import com.mirth.connect.model.converters.ObjectXMLSerializer;
4748
import com.mirth.connect.model.notification.Notification;
4849
import com.mirth.connect.util.MirthSSLUtil;
4950

5051
public class ConnectServiceUtil {
51-
private final static String URL_CONNECT_SERVER = "https://connect.mirthcorp.com";
52+
private final static String URL_CONNECT_SERVER = BrandingConstants.CONNECT_SERVER_URL;
5253
private final static String URL_REGISTRATION_SERVLET = "/RegistrationServlet";
5354
private final static String URL_USAGE_SERVLET = "/UsageStatisticsServlet";
5455
private final static String URL_NOTIFICATION_SERVLET = "/NotificationServlet";
@@ -233,14 +234,11 @@ public static boolean sendStatistics(String serverId, String mirthVersion, boole
233234
}
234235

235236
private static CloseableHttpClient getClient(String[] protocols, String[] cipherSuites) {
236-
RegistryBuilder<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create();
237-
String[] enabledProtocols = MirthSSLUtil.getEnabledHttpsProtocols(protocols);
238-
String[] enabledCipherSuites = MirthSSLUtil.getEnabledHttpsCipherSuites(cipherSuites);
239-
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(SSLContexts.createSystemDefault(), enabledProtocols, enabledCipherSuites, SSLConnectionSocketFactory.STRICT_HOSTNAME_VERIFIER);
240-
socketFactoryRegistry.register("https", sslConnectionSocketFactory);
241-
242-
BasicHttpClientConnectionManager httpClientConnectionManager = new BasicHttpClientConnectionManager(socketFactoryRegistry.build());
237+
BasicHttpClientConnectionManager httpClientConnectionManager = new BasicHttpClientConnectionManager();
243238
httpClientConnectionManager.setSocketConfig(SocketConfig.custom().setSoTimeout(TIMEOUT).build());
244-
return HttpClients.custom().setConnectionManager(httpClientConnectionManager).build();
239+
return HttpClients.custom()
240+
.useSystemProperties()
241+
.setConnectionManager(httpClientConnectionManager)
242+
.build();
245243
}
246244
}

server/src/com/mirth/connect/server/Mirth.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,10 @@ public void startup() {
401401
printSplashScreen();
402402

403403
// schedule usage statistics to be sent at startup and every 24 hours
404-
Timer timer = new Timer();
405-
timer.schedule(new UsageSenderTask(), 0, ConnectServiceUtil.MILLIS_PER_DAY);
404+
if (BrandingConstants.SEND_USAGE_STATISTICS) {
405+
Timer timer = new Timer();
406+
timer.schedule(new UsageSenderTask(), 0, ConnectServiceUtil.MILLIS_PER_DAY);
407+
}
406408
}
407409

408410
/**

0 commit comments

Comments
 (0)