Skip to content

Commit

Permalink
Fix(EMM): Fix missing managed configurations used as NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebuzz committed Dec 17, 2024
1 parent b888db3 commit 1d2ebc2
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions app/src/main/java/org/glpi/inventory/agent/ui/ActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,9 @@ private void resolveRestrictions() {
}

if (appRestrictions.containsKey("frequency")) {
editor.putString("timeInventory", appRestrictions.getString("frequency"));
editor.putString("timeInventory", appRestrictions.getString("frequency", "Week"));
enterpriseFeedback(getApplicationContext(), "frequency", "frequency option set successfully", appRestrictions.getString("frequency"), KeyedAppState.SEVERITY_INFO);
AgentLog.e("EMM - set frequency to " + appRestrictions.getString("frequency"));
AgentLog.e("EMM - set frequency to " + appRestrictions.getString("frequency", "Week"));
editor.apply();
}

Expand All @@ -471,11 +471,21 @@ private void resolveRestrictions() {

try {
jsonServerConfig.put("address", serverConfig.getString("server_url"));
jsonServerConfig.put("tag", serverConfig.getString("server_tag"));
jsonServerConfig.put("login", serverConfig.getString("server_login"));
jsonServerConfig.put("pass", serverConfig.getString("server_password"));
jsonServerConfig.put("itemtype", serverConfig.getString("server_itemtype"));
jsonServerConfig.put("serial", serverConfig.getString("server_custom_asset_serial"));

String tag = serverConfig.containsKey("server_tag") ? serverConfig.getString("server_tag") : "";
jsonServerConfig.put("tag", tag);

String login = serverConfig.containsKey("server_login") ? serverConfig.getString("server_login") : "";
jsonServerConfig.put("login", login);

String pass = serverConfig.containsKey("server_password") ? serverConfig.getString("server_password") : "";
jsonServerConfig.put("pass", pass);

String itemType = serverConfig.containsKey("server_itemtype") ? serverConfig.getString("server_itemtype") : "Computer";
jsonServerConfig.put("itemtype", itemType);

String serial = serverConfig.containsKey("server_custom_asset_serial") ? serverConfig.getString("server_custom_asset_serial") : "";
jsonServerConfig.put("serial", serial);

AgentLog.e("EMM - Receive the following configuration '" + jsonServerConfig.toString());

Expand Down

0 comments on commit 1d2ebc2

Please sign in to comment.