Skip to content
This repository was archived by the owner on Oct 5, 2021. It is now read-only.

Commit e095911

Browse files
committed
Merge branch 'rest-api-improvements' of https://github.com/wso2/product-emm into rest-api-improvements
UI related changes
2 parents 217ece1 + 42eaaa4 commit e095911

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+965
-291
lines changed

modules/apps/jaggery/emm/src/emm/api/invoker-api.jag

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var log = new Log("api/invoker-api.jag");
2424

2525
var constants = require("/modules/constants.js");
2626
var mdmProps = require('/config/mdm-props.js').config();
27-
var serviceInvokers = require("/modules/backend-service-invoker.js").backendServiceInvoker;
27+
var serviceInvokers = require("/modules/backend-service-invoker.js")["backendServiceInvoker"];
2828

2929
var result;
3030

modules/apps/jaggery/emm/src/emm/units/role-listing/public/js/role-listing.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ var loadPaginatedObjects = function (objectGridId, objectGridContainer, objectGr
6060
function loadRoles(searchQuery) {
6161
var loadingContent = $("#loading-content");
6262
loadingContent.show();
63-
var serviceURL = "/mdm-admin/roles";
63+
var serviceURL = "/api/device-mgt/v1.0/roles";
6464
if (searchQuery) {
65-
serviceURL = serviceURL + "/search?filter=" + searchQuery;
65+
serviceURL = serviceURL + "?filter=" + searchQuery;
6666
}
6767
var callback = function (data) {
6868
if (data != null || data == "null") {
@@ -140,7 +140,7 @@ function hidePopup() {
140140
*/
141141
$("#role-grid").on("click", ".remove-role-link", function () {
142142
var role = $(this).data("role");
143-
var removeRoleAPI = "/mdm-admin/roles?rolename=" + role;
143+
var removeRoleAPI = "/api/device-mgt/v1.0/roles?rolename=" + role;
144144

145145
$(modalPopupContent).html($('#remove-role-modal-content').html());
146146
showPopup();

modules/apps/jaggery/emm/src/emm/units/service-invoker-utility/public/js/invoker-lib.js

+18-9
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,43 @@ var invokerUtil = function () {
2020

2121
var module = {};
2222

23-
var END_POINT = window.location.origin+"/emm/api/invoker/execute/";
23+
var END_POINT = window.location.origin + "/emm/api/invoker/execute/";
2424

2525
module.get = function (url, successCallback, errorCallback) {
2626
var payload = null;
2727
execute("GET", url, payload, successCallback, errorCallback);
2828
};
29+
2930
module.post = function (url, payload, successCallback, errorCallback) {
3031
execute("POST", url, payload, successCallback, errorCallback);
3132
};
33+
3234
module.put = function (url, payload, successCallback, errorCallback) {
3335
execute("PUT", url, payload, successCallback, errorCallback);
3436
};
37+
3538
module.delete = function (url, successCallback, errorCallback) {
3639
var payload = null;
3740
execute("DELETE", url, payload, successCallback, errorCallback);
3841
};
39-
function execute (methoad, url, payload, successCallback, errorCallback) {
40-
var data = {
42+
43+
var execute = function (method, url, payload, successCallback, errorCallback) {
44+
var request = {
4145
url: END_POINT,
4246
type: "POST",
4347
contentType: "application/json",
4448
accept: "application/json",
4549
success: successCallback
4650
};
47-
var paramValue = {};
48-
paramValue.actionMethod = methoad;
49-
paramValue.actionUrl = url;
50-
paramValue.actionPayload = JSON.stringify(payload)
51-
data.data = JSON.stringify(paramValue);
52-
$.ajax(data).fail(function (jqXHR) {
51+
52+
var data = {};
53+
data.actionMethod = method;
54+
data.actionUrl = url;
55+
data.actionPayload = JSON.stringify(payload);
56+
57+
request.data = JSON.stringify(data);
58+
59+
$.ajax(request).fail(function (jqXHR) {
5360
if (jqXHR.status == "401") {
5461
console.log("Unauthorized access attempt!");
5562
$(modalPopupContent).html($('#error-msg').html());
@@ -59,5 +66,7 @@ var invokerUtil = function () {
5966
}
6067
});
6168
};
69+
6270
return module;
71+
6372
}();

modules/distribution/src/assembly/bin.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@
478478
</directory>
479479
<outputDirectory>${pom.artifactId}-${pom.version}/repository/deployment/server/webapps</outputDirectory>
480480
<includes>
481-
<include>certificate-mgt.war</include>
481+
<include>api#scep-mgt#v1.0.war</include>
482482
</includes>
483483
</fileSet>
484484
<!--fileSet>

modules/mobile-agents/android/client/client/src/main/AndroidManifest.xml

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<?xml version="1.0" encoding="utf-8"?><!--
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
23
~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
34
~
45
~ WSO2 Inc. licenses this file to you under the Apache License,
@@ -44,6 +45,7 @@
4445
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
4546
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
4647
<uses-permission android:name="android.permission.GET_TASKS" />
48+
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
4749

4850
<permission
4951
android:name="org.wso2.emm.agent.permission.C2D_MESSAGE"
@@ -57,6 +59,7 @@
5759
android:allowBackup="true"
5860
android:icon="@drawable/ic_launcher"
5961
android:label="@string/app_name"
62+
android:largeHeap="true"
6063
android:screenOrientation="portrait"
6164
android:theme="@style/TopBarTheme">
6265
<activity
@@ -122,6 +125,17 @@
122125
<data android:scheme="package" />
123126
</intent-filter>
124127
</receiver>
128+
<receiver
129+
android:name=".services.NetworkConnectedReceiver"
130+
android:enabled="true"
131+
android:exported="false">
132+
<intent-filter>
133+
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
134+
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
135+
136+
<category android:name="android.intent.category.DEFAULT" />
137+
</intent-filter>
138+
</receiver>
125139

126140
<service
127141
android:name=".services.ApplicationManagementService"
@@ -131,6 +145,7 @@
131145
<action android:name="org.wso2.emm.agent.START_SERVICE" />
132146
</intent-filter>
133147
</service>
148+
<service android:name=".services.EnrollmentService" />
134149
<service
135150
android:name=".GCMIntentService"
136151
android:exported="false">
@@ -206,4 +221,3 @@
206221
android:exported="false" />
207222
</application>
208223
</manifest>
209-

modules/mobile-agents/android/client/client/src/main/java/org/wso2/emm/agent/AgentReceptionActivity.java

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import android.os.Bundle;
2828
import android.view.View;
2929
import android.widget.Button;
30-
3130
import android.widget.Toast;
3231
import org.wso2.emm.agent.api.DeviceState;
3332
import org.wso2.emm.agent.utils.CommonUtils;

modules/mobile-agents/android/client/client/src/main/java/org/wso2/emm/agent/AlreadyRegisteredActivity.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,11 @@ private void startUnRegistration() {
189189

190190
if (regId != null && !regId.isEmpty()) {
191191
if (CommonUtils.isNetworkAvailable(context)) {
192-
String serverIP = Preference.getString(AlreadyRegisteredActivity.this, Constants.PreferenceFlag.IP);
192+
String serverIP = Constants.DEFAULT_HOST;
193+
String prefIP = Preference.getString(AlreadyRegisteredActivity.this, Constants.PreferenceFlag.IP);
194+
if (prefIP != null) {
195+
serverIP = prefIP;
196+
}
193197
if (serverIP != null && !serverIP.isEmpty()) {
194198
stopPolling();
195199
ServerConfig utils = new ServerConfig();
@@ -276,8 +280,11 @@ protected void onResume() {
276280

277281
if (isRegistered) {
278282
if (CommonUtils.isNetworkAvailable(context)) {
279-
280-
String serverIP = Preference.getString(context, Constants.PreferenceFlag.IP);
283+
String serverIP = Constants.DEFAULT_HOST;
284+
String prefIP = Preference.getString(context, Constants.PreferenceFlag.IP);
285+
if (prefIP != null) {
286+
serverIP = prefIP;
287+
}
281288
regId = Preference.getString(context, Constants.PreferenceFlag.REG_ID);
282289

283290
if (regId != null) {

modules/mobile-agents/android/client/client/src/main/java/org/wso2/emm/agent/AuthenticationActivity.java

+20-5
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,11 @@ private void startAuthentication() {
286286
* @param clientSecret client secret value to access APIs.
287287
*/
288288
private void initializeIDPLib(String clientKey, String clientSecret) {
289-
290-
String serverIP = Preference.getString(AuthenticationActivity.this, Constants.PreferenceFlag.IP);
289+
String serverIP = Constants.DEFAULT_HOST;
290+
String prefIP = Preference.getString(AuthenticationActivity.this, Constants.PreferenceFlag.IP);
291+
if (prefIP != null) {
292+
serverIP = prefIP;
293+
}
291294
if (serverIP != null && !serverIP.isEmpty()) {
292295
ServerConfig utils = new ServerConfig();
293296
utils.setServerIP(serverIP);
@@ -418,7 +421,11 @@ public void run() {
418421
* Retriever license agreement details from the server.
419422
*/
420423
private void getLicenseFromServer() {
421-
String ipSaved = Preference.getString(context.getApplicationContext(), Constants.PreferenceFlag.IP);
424+
String ipSaved = Constants.DEFAULT_HOST;
425+
String prefIP = Preference.getString(context.getApplicationContext(), Constants.PreferenceFlag.IP);
426+
if (prefIP != null) {
427+
ipSaved = prefIP;
428+
}
422429

423430
if (ipSaved != null && !ipSaved.isEmpty()) {
424431
ServerConfig utils = new ServerConfig();
@@ -486,7 +493,11 @@ public void run() {
486493
}
487494
});
488495

489-
String ipSaved = Preference.getString(context.getApplicationContext(),Constants.PreferenceFlag.IP);
496+
String ipSaved = Constants.DEFAULT_HOST;
497+
String prefIP = Preference.getString(context.getApplicationContext(), Constants.PreferenceFlag.IP);
498+
if (prefIP != null) {
499+
ipSaved = prefIP;
500+
}
490501

491502
if (ipSaved != null && !ipSaved.isEmpty()) {
492503
ServerConfig utils = new ServerConfig();
@@ -932,7 +943,11 @@ private void showAuthCommonErrorMessage() {
932943
* @throws AndroidAgentException
933944
*/
934945
private void getClientCredentials() {
935-
String ipSaved = Preference.getString(context.getApplicationContext(), Constants.PreferenceFlag.IP);
946+
String ipSaved = Constants.DEFAULT_HOST;
947+
String prefIP = Preference.getString(context.getApplicationContext(), Constants.PreferenceFlag.IP);
948+
if (prefIP != null) {
949+
ipSaved = prefIP;
950+
}
936951
progressDialog = ProgressDialog.show(context, getResources().getString(R.string.dialog_authenticate), getResources().
937952
getString(R.string.dialog_message_please_wait), true);
938953
if (ipSaved != null && !ipSaved.isEmpty()) {

modules/mobile-agents/android/client/client/src/main/java/org/wso2/emm/agent/GCMRegistrationManager.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class GCMRegistrationManager implements APIResultCallBack {
5050
private GoogleCloudMessaging cloudMessaging;
5151

5252
private String googleProjectNumber;
53-
private Activity activity;
53+
private Context activity;
5454
private String registrationId;
5555
private final static int REQUEST_CODE = 4034;
5656
private DialogInterface.OnClickListener registrationFailedClickListener = new DialogInterface.OnClickListener() {
@@ -60,7 +60,7 @@ public void onClick(DialogInterface arg0, int arg1) {
6060
}
6161
};
6262

63-
public GCMRegistrationManager(Activity activity, String googleProjectNumber) {
63+
public GCMRegistrationManager(Context activity, String googleProjectNumber) {
6464
this.activity = activity;
6565
this.googleProjectNumber = googleProjectNumber;
6666
cloudMessaging = GoogleCloudMessaging.getInstance(activity);
@@ -70,7 +70,7 @@ private Context getContext() {
7070
return activity.getApplicationContext();
7171
}
7272

73-
private Activity getActivity() {
73+
private Context getActivity() {
7474
return activity;
7575
}
7676

@@ -134,7 +134,11 @@ public void sendRegistrationId() throws AndroidAgentException {
134134
deviceInfoPayload.build();
135135

136136
String replyPayload = deviceInfoPayload.getDeviceInfoPayload();
137-
String ipSaved = Preference.getString(getContext(), Constants.PreferenceFlag.IP);
137+
String ipSaved = Constants.DEFAULT_HOST;
138+
String prefIP = Preference.getString(getContext(), Constants.PreferenceFlag.IP);
139+
if (prefIP != null) {
140+
ipSaved = prefIP;
141+
}
138142

139143
if (ipSaved != null && !ipSaved.isEmpty()) {
140144
ServerConfig utils = new ServerConfig();

modules/mobile-agents/android/client/client/src/main/java/org/wso2/emm/agent/RegistrationActivity.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,11 @@ private void registerDevice() {
9191
// Check network connection availability before calling the API.
9292
if (CommonUtils.isNetworkAvailable(context)) {
9393
// Call device registration API.
94-
String ipSaved = Preference.getString(context.getApplicationContext(),Constants.PreferenceFlag.IP);
95-
94+
String ipSaved = Constants.DEFAULT_HOST;
95+
String prefIP = Preference.getString(context.getApplicationContext(), Constants.PreferenceFlag.IP);
96+
if (prefIP != null) {
97+
ipSaved = prefIP;
98+
}
9699
if (ipSaved != null && !ipSaved.isEmpty()) {
97100
ServerConfig utils = new ServerConfig();
98101
utils.setServerIP(ipSaved);
@@ -280,8 +283,11 @@ public void sendRegistrationId() throws AndroidAgentException {
280283
deviceInfoPayload.build();
281284

282285
String replyPayload = deviceInfoPayload.getDeviceInfoPayload();
283-
String ipSaved = Preference.getString(context, Constants.PreferenceFlag.IP);
284-
286+
String ipSaved = Constants.DEFAULT_HOST;
287+
String prefIP = Preference.getString(context, Constants.PreferenceFlag.IP);
288+
if (prefIP != null) {
289+
ipSaved = prefIP;
290+
}
285291
if (ipSaved != null && !ipSaved.isEmpty()) {
286292
ServerConfig utils = new ServerConfig();
287293
utils.setServerIP(ipSaved);

0 commit comments

Comments
 (0)