diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml index c42f649f4..adb13b61b 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml index 07289bf84..1dd5181a7 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml index 35fe1f2f5..4c09bb788 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index dfa9bac32..68986eef6 100644 --- a/components/analytics/iot-analytics/pom.xml +++ b/components/analytics/iot-analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins analytics - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index befc59e46..ff7786e80 100644 --- a/components/analytics/pom.xml +++ b/components/analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml index 2b0f926da..9922eac4b 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/AndroidManifest.xml @@ -50,6 +50,12 @@ android:label="@string/app_name" > + + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherReceiver.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherReceiver.java index b09d15a88..4ece0fe95 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherReceiver.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherReceiver.java @@ -18,16 +18,18 @@ import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.util.Log; /** * This creates and AlarmManagerService that triggers the data uploader service with a 30 seconds interval. */ public class DataPublisherReceiver extends BroadcastReceiver { - private static int ALARM_INTERVAL = 30000; + private static int ALARM_INTERVAL = 1000; @Override public void onReceive(Context context, Intent intent) { AlarmManager service = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); + Log.i("Data Publisher", "triggered"); Intent i = new Intent(context, DataPublisherService.class); PendingIntent pending = PendingIntent.getService(context, 0, i, 0); service.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), ALARM_INTERVAL, pending); diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/SenseScheduleReceiver.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/SenseScheduleReceiver.java index 41ff9feff..4b76b5cca 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/SenseScheduleReceiver.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/SenseScheduleReceiver.java @@ -25,7 +25,7 @@ import java.util.Calendar; * This is a service which triggers to collect */ public class SenseScheduleReceiver extends BroadcastReceiver { - private static final int ALARM_INTERVAL = 5000; + private static final int ALARM_INTERVAL = 1000; @Override public void onReceive(Context context, Intent intent) { @@ -35,7 +35,7 @@ public class SenseScheduleReceiver extends BroadcastReceiver { Calendar cal = Calendar.getInstance(); - cal.add(Calendar.SECOND, 30); + cal.add(Calendar.SECOND, 10); service.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), ALARM_INTERVAL, pending); } diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/SenseService.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/SenseService.java index ec62d8f4f..7554f6524 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/SenseService.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/SenseService.java @@ -56,7 +56,7 @@ public class SenseService extends Service { SenseDataReceiverManager.registerActivityDataReceiver(this); SenseDataReceiverManager.registerSmsDataReceiver(this); SenseDataReceiverManager.registerAppDataReceiver(this); - SenseDataReceiverManager.registerNetworkDataReceiver(this); + SenseDataReceiverManager.registerNetworkDataReader(this); //service will not be stopped until we manually stop the service return Service.START_NOT_STICKY; @@ -70,7 +70,7 @@ public class SenseService extends Service { SenseDataReceiverManager.unregisterActivityDataReceiver(this); SenseDataReceiverManager.unregisterSmsDataReceiver(this); SenseDataReceiverManager.unregisterAppDataReceiver(this); - SenseDataReceiverManager.unregisterNetworkDataReceiver(this); + SenseDataReceiverManager.unregisterNetworkDataReader(); SenseWakeLock.releaseCPUWakeLock(); super.onDestroy(); diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/battery/BatteryDataReceiver.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/battery/BatteryDataReceiver.java index 794f69b3d..0a971ab61 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/battery/BatteryDataReceiver.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/battery/BatteryDataReceiver.java @@ -13,10 +13,15 @@ */ package org.wso2.carbon.iot.android.sense.event.streams.battery; +import android.app.AlarmManager; +import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.os.BatteryManager; +import android.util.Log; +import org.wso2.carbon.iot.android.sense.data.publisher.DataPublisherService; import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; /** @@ -24,21 +29,20 @@ import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; */ public class BatteryDataReceiver extends BroadcastReceiver { + private final long ALARM_INTERVAL = 1000; /** - * when the data is retreived then its added to a inmemory map. + * When the data is retrieved then its added to a in memory map. * - * @param context of the reciever. - * @param intent of the reciver + * @param context of the receiver. + * @param intent of the receiver */ @Override public void onReceive(Context context, Intent intent) { - if (Intent.ACTION_BATTERY_OKAY.equals(intent.getAction())) { - SenseDataHolder.getBatteryDataHolder().add(new BatteryData(BatteryData.State.OK)); - } else if (Intent.ACTION_BATTERY_LOW.equals(intent.getAction())) { - SenseDataHolder.getBatteryDataHolder().add(new BatteryData(BatteryData.State.LOW)); - } else { - SenseDataHolder.getBatteryDataHolder().add(new BatteryData(intent)); - } + AlarmManager service = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); + Log.i("Battery Data Receiver", "Triggered"); + Intent i = new Intent(context, BatteryReaderService.class); + PendingIntent pending = PendingIntent.getService(context, 0, i, 0); + service.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), ALARM_INTERVAL, pending); } } diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/battery/BatteryReaderService.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/battery/BatteryReaderService.java new file mode 100644 index 000000000..c2ea5db9f --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/battery/BatteryReaderService.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.iot.android.sense.event.streams.battery; + +import android.app.IntentService; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.BatteryManager; +import android.os.IBinder; +import android.support.annotation.Nullable; +import android.util.Log; + +import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; + +public class BatteryReaderService extends IntentService { + + private Context context; + + public BatteryReaderService() { + super("BatteryReaderService"); + } + + @Nullable + @Override + public IBinder onBind(Intent intent) { + return null; + } + + @Override + protected void onHandleIntent(Intent intent) { + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(Intent.ACTION_BATTERY_LOW); + intentFilter.addAction(Intent.ACTION_BATTERY_OKAY); + intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED); + Intent intent1 = registerReceiver(null, intentFilter); + + Log.i("Battery Data", String.valueOf(intent1.getIntExtra(BatteryManager.EXTRA_LEVEL, 0))); + if (Intent.ACTION_BATTERY_OKAY.equals(intent.getAction())) { + SenseDataHolder.getBatteryDataHolder().add(new BatteryData(BatteryData.State.OK)); + } else if (Intent.ACTION_BATTERY_LOW.equals(intent.getAction())) { + SenseDataHolder.getBatteryDataHolder().add(new BatteryData(BatteryData.State.LOW)); + } else { + SenseDataHolder.getBatteryDataHolder().add(new BatteryData(intent1)); + } + } +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/data/NetworkData.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/data/NetworkData.java index 47b32325c..c8fcfac4a 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/data/NetworkData.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/data/NetworkData.java @@ -23,19 +23,16 @@ import java.util.Date; public class NetworkData { //Mobile or Wifi - private String DATA_TYPE; + private String type; private long dataReceived; private long dataSent; private long timeStamp; - public NetworkData(long received, long sent) { - this.dataReceived = received; - this.dataSent = sent; - this.timeStamp = new Date().getTime(); + public NetworkData() { } public String getDataType() { - return DATA_TYPE; + return type; } public long getDataReceived() { @@ -57,4 +54,16 @@ public class NetworkData { public long getTimeStamp() { return timeStamp; } + + public void setTimeStamp(long timeStamp) { + this.timeStamp = timeStamp; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } } diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/data/NetworkDataReader.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/data/NetworkDataReader.java new file mode 100644 index 000000000..541be98b4 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/data/NetworkDataReader.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.iot.android.sense.event.streams.data; + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.TrafficStats; +import android.os.AsyncTask; +import android.os.Handler; +import android.util.Log; + +import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; + +import java.util.Date; + +/** + * Class to read data sent and received by the device. + */ +public class NetworkDataReader extends AsyncTask { + + private NetworkData networkData; + private Context context; + private Handler mHandler = new Handler(); + private long mStartRX = 0; + private long mStartTX = 0; + private final String WIFI = "WIFI"; + private final String MOBILE = "MOBILE"; + private String connectionType; + + public NetworkDataReader(Context context) { + this.context = context; + } + + @Override + protected Long doInBackground(Void... voids) { + + ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + networkData = new NetworkData(); + + if (getConnectionType(connectivityManager, ConnectivityManager.TYPE_WIFI)) { + connectionType = WIFI; + } else if (getConnectionType(connectivityManager, ConnectivityManager.TYPE_MOBILE)) { + connectionType = MOBILE; + } + + mStartRX = TrafficStats.getTotalRxBytes(); + mStartTX = TrafficStats.getTotalTxBytes(); + if (mStartRX == TrafficStats.UNSUPPORTED || mStartTX == TrafficStats.UNSUPPORTED) { + Log.e("ERROR", "Not connected."); + } else { + mHandler.postDelayed(mRunnable, 10000); + } + return null; + } + + /** + * Collect data sent and received with in 10 second time frames. + */ + private final Runnable mRunnable = new Runnable() { + public void run() { + long rxBytes = TrafficStats.getTotalRxBytes() - mStartRX; + long txBytes = TrafficStats.getTotalTxBytes() - mStartTX; + Log.i("Usage: ", String.valueOf(rxBytes) + " " + String.valueOf(txBytes) + " " + System.currentTimeMillis()); + networkData.setType(connectionType); + networkData.setTimeStamp(new Date().getTime()); + networkData.setDataSent(txBytes); + networkData.setDataReceived(rxBytes); + SenseDataHolder.getNetworkDataHolder().add(networkData); + mHandler.postDelayed(mRunnable, 10000); + } + }; + + /** + * Get the type of the connection currently have. + */ + private boolean getConnectionType(ConnectivityManager manager, Integer type) { + NetworkInfo networkInfo = manager.getNetworkInfo(type); + return networkInfo.isConnected(); + } +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/data/NetworkDataReceiver.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/data/NetworkDataReceiver.java deleted file mode 100644 index bcf353ffe..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/data/NetworkDataReceiver.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.iot.android.sense.event.streams.data; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -import org.wso2.carbon.iot.android.sense.util.SenseDataHolder; - -public class NetworkDataReceiver extends BroadcastReceiver{ - - @Override - public void onReceive(Context context, Intent intent) { - long sent = android.net.TrafficStats.getTotalTxBytes(); - long received = android.net.TrafficStats.getTotalRxBytes(); - Log.d("NetworkData :", "Received: " + sent + " Received : " + received); - - NetworkData networkData = new NetworkData(received, sent); - - SenseDataHolder.getNetworkDataHolder().add(networkData); - - } - -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java index 6514fbb51..8a31fdf9c 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseClientAsyncExecutor.java @@ -56,6 +56,7 @@ public class SenseClientAsyncExecutor extends AsyncTask androidsense-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/Android-Battery-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/Android-Battery-ExecutionPlan.siddhiql new file mode 100755 index 000000000..68ed7fd49 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/Android-Battery-ExecutionPlan.siddhiql @@ -0,0 +1,19 @@ +@Plan:name('Android-Battery-ExecutionPlan') + +@Plan:description('Find the battery status of the android device.') + + +@Import('org.wso2.iot.android.battery:1.0.0') +define stream BatteryStream (meta_owner string, meta_deviceId string, meta_timestamp long, level int, state string, status string, temperature int); + + +@Export('org.wso2.iot.android.battery.stats:1.0.0') +define stream BatteryStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, level int, state +string, status string, temperature int, year int, month int, day int, hour int, minute int); + +partition with (meta_deviceId of BatteryStream) +begin + from BatteryStream + select meta_owner, meta_deviceId, meta_timestamp, level, state, status, temperature, time:extract(preState.meta_timestamp, 'year') as year, time:extract(preState.meta_timestamp, 'month') as month, time:extract(preState.meta_timestamp, 'day') as day, time:extract(preState.meta_timestamp, 'hour') as hour, time:extract(preState.meta_timestamp, 'minute') as minute + insert into BatteryStatsStream; +end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/artifact.xml new file mode 100644 index 000000000..70ab416ec --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_battery_execution_plan/artifact.xml @@ -0,0 +1,24 @@ + + + + + Android-Battery-ExecutionPlan.siddhiql + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql index 13f71ac3f..b6fa8cc04 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql @@ -11,7 +11,7 @@ define stream CallStatsStream (meta_owner string, meta_deviceId string, meta_tim partition with (meta_deviceId of CallStream) begin - from CallStream[type == 'INCOMING' OR type == 'OUTGOING'] + from CallStream select meta_owner, meta_deviceId, meta_timestamp, number, type, (endTime - startTime) as duration, time:extract(meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute insert into CallStatsStream; end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/conf.json similarity index 53% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/conf.json rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/conf.json index c65b0b7d9..ee8bfc8d5 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/conf.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/conf.json @@ -1,17 +1,19 @@ { "provider-conf": { - "streamName": "org.wso2.iot.android.battery:1.0.0", - "provider-name": "realtime" + "tableName": "ORG_WSO2_IOT_ANDROID_BATTERY_STATS", + "query": "", + "limit": "", + "provider-name": "batch" }, "chart-conf": { - "x": "TIMESTAMP", + "x": "meta_timestamp", "xType": "time", "y": "level", "yType": "number", "color": "None", "mode": "stack", "maxLength": "30", - "gadget-name": "Android Battery Level Chart", + "gadget-name": "Battery History", "chart-name": "area-chart" } } \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/gadget-controller.jag b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/gadget-controller.jag similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/gadget-controller.jag rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/gadget-controller.jag diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/gadget.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/gadget.json new file mode 100644 index 000000000..2f9196eb5 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/gadget.json @@ -0,0 +1,9 @@ +{ + "id": "Android_Battery_History_Chart", + "title": "Battery History", + "type": "gadget", + "thumbnail": "gadget/Android_Battery_History_Chart/thumbnail.png", + "data": { + "url": "gadget/Android_Battery_History_Chart/gadget.xml" + } +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/gadget.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/gadget.xml similarity index 80% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/gadget.xml rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/gadget.xml index 3c0b85373..e0d5437a9 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/gadget.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/gadget.xml @@ -1,14 +1,14 @@ - + - - + + @@ -25,15 +25,13 @@ - - - + @@ -45,8 +43,6 @@ - - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/area-chart-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/area-chart-api.js similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/area-chart-api.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/area-chart-api.js diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/batch-provider-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/batch-provider-api.js new file mode 100644 index 000000000..30c96902a --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/batch-provider-api.js @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var getConfig, validate, getMode, getSchema, getData, registerCallBackforPush; + +(function() { + + var PROVIDERS_LOCATION = '/extensions/providers/'; + + var PROVIDER_NAME = 'batch'; + var TYPE = "type"; + var TABLE_NAME = "tableName"; + var HTTPS_TRANSPORT = "https"; + var CONTENT_TYPE_JSON = "application/json"; + var AUTHORIZATION_HEADER = "Authorization"; + var USER_TOKEN = "user"; + var TENANT_DOMAIN = "domain"; + var CONST_AT = "@"; + var USERNAME = "username"; + var HTTP_USER_NOT_AUTHENTICATED = 403; + var JS_MAX_VALUE = "9007199254740992"; + var JS_MIN_VALUE = "-9007199254740992"; + + var typeMap = { + "bool" : "string", + "boolean" : "string", + "string" : "string", + "int" : "number", + "integer" : "number", + "long" : "number", + "double" : "number", + "float" : "number", + "time": "time" + }; + + var log = new Log(); + var carbon = require('carbon'); + var configs = require('/configs/designer.json'); + var utils = require('/modules/utils.js'); + var JSUtils = Packages.org.wso2.carbon.analytics.jsservice.Utils; + var AnalyticsCachedJSServiceConnector = Packages.org.wso2.carbon.analytics.jsservice.AnalyticsCachedJSServiceConnector; + var AnalyticsCache = Packages.org.wso2.carbon.analytics.jsservice.AnalyticsCachedJSServiceConnector.AnalyticsCache; + var cacheTimeoutSeconds = 5; + var loggedInUser = null; + + if (configs.cacheTimeoutSeconds) { + cacheTimeoutSeconds = parseInt(configs.cacheTimeoutSeconds); + } + var cacheSizeBytes = 1024 * 1024 * 1024; // 1GB + if (configs.cacheSizeBytes) { + cacheSizeBytes = parseInt(configs.cacheSizeBytes); + } + response.contentType = CONTENT_TYPE_JSON; + + var authParam = request.getHeader(AUTHORIZATION_HEADER); + if (authParam != null) { + credentials = JSUtils.authenticate(authParam); + loggedInUser = credentials[0]; + } else { + var token = session.get(USER_TOKEN); + if (token != null) { + loggedInUser = token[USERNAME] + CONST_AT + token[TENANT_DOMAIN]; + } else { + log.error("user is not authenticated!"); + response.status = HTTP_USER_NOT_AUTHENTICATED; + print('{ "status": "Failed", "message": "User is not authenticated." }'); + return; + } + } + + var cache = application.get("AnalyticsWebServiceCache"); + if (cache == null) { + cache = new AnalyticsCache(cacheTimeoutSeconds, cacheSizeBytes); + application.put("AnalyticsWebServiceCache", cache); + } + var connector = new AnalyticsCachedJSServiceConnector(cache); + + /** + * require the existing config.json and push any dynamic fields that needs to be populated in the UI + */ + getConfig = function() { + var formConfig = require(PROVIDERS_LOCATION + '/' + PROVIDER_NAME + '/config.json'); + var tables; + try { + tables = JSON.parse(connector.getTableList(loggedInUser).getMessage()); + } catch (e) { + log.error(e); + } + var configs = formConfig.config; + configs.forEach(function(config) { + if (config.fieldName === TABLE_NAME) { + config.valueSet = tables; + } + }); + return formConfig; + } + + /** + * validate the user input of provider configuration + * @param providerConfig + */ + validate = function(providerConfig) { + /* + validate the form and return + + */ + return true; + } + + /** + * returns the data mode either push or pull + */ + getMode = function() { + return "PULL"; + } + + /** + * returns an array of column names & types + * @param providerConfig + */ + getSchema = function(providerConfig) { + var schema = []; + var tableName = providerConfig["tableName"]; + var result = connector.getTableSchema(loggedInUser, tableName).getMessage(); + result = JSON.parse(result); + + var columns = result.columns; + Object.getOwnPropertyNames(columns).forEach(function(name, idx, array) { + var type = "ordinal"; + if(columns[name]['type']) { + type = columns[name]['type']; + } + schema.push({ + fieldName: name, + fieldType: typeMap[type.toLowerCase()] + }); + }); + // log.info(schema); + return schema; + }; + + /** + * returns the actual data + * @param providerConfig + * @param limit + */ + getData = function(providerConfig, limit) { + var tableName = providerConfig.tableName; + var query = providerConfig.query; + var limit = 100; + if (providerConfig.limit) { + limit = providerConfig.limit; + } + var result; + //if there's a filter present, we should perform a Lucene search instead of reading the table + if (query) { + var filter = { + "query": query, + "start": 0, + "count": limit + }; + result = connector.search(loggedInUser, tableName, stringify(filter)).getMessage(); + } else { + var from = JS_MIN_VALUE; + var to = JS_MAX_VALUE; + result = connector.getRecordsByRange(loggedInUser, tableName, from, to, 0, limit, null).getMessage(); + + } + result = JSON.parse(result); + var data = []; + for (var i = 0; i < result.length; i++) { + var values = result[i].values; + data.push(values); + } + return data; + }; + +}()); diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/gadget-core.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/gadget-core.js similarity index 70% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/gadget-core.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/gadget-core.js index 8bfc5f742..9dfe8683b 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/gadget-core.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/gadget-core.js @@ -19,9 +19,14 @@ $(function () { var schema; var pref = new gadgets.Prefs(); + var refreshInterval; + var providerData; + var CHART_CONF = 'chart-conf'; var PROVIDER_CONF = 'provider-conf'; + var REFRESH_INTERVAL = 'refreshInterval'; + var init = function () { $.ajax({ url: gadgetLocation + '/conf.json', @@ -41,17 +46,33 @@ var init = function () { } }); + getProviderData(); + } }); }; +var getProviderData = function (){ + $.ajax({ + url: gadgetLocation + '/gadget-controller.jag?action=getData', + method: "POST", + data: JSON.stringify(conf), + contentType: "application/json", + async: false, + success: function (data) { + providerData = data; + } + }); + return providerData; +}; + var drawGadget = function (){ - draw('#canvas', conf[CHART_CONF], schema, null); - registerCallBackforPush(conf[PROVIDER_CONF], schema, function(providerData) { - update(providerData); - }); + draw('#canvas', conf[CHART_CONF], schema, providerData); + setInterval(function() { + draw('#canvas', conf[CHART_CONF], schema, getProviderData()); + },pref.getInt(REFRESH_INTERVAL)); }; diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/gadget-util.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/gadget-util.js similarity index 97% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/gadget-util.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/gadget-util.js index 7f3954949..2317e157d 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/gadget-util.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/js/core/gadget-util.js @@ -14,7 +14,7 @@ * limitations under the License. */ var getGadgetLocation = function (callback) { - var gadgetLocation = "/portal/store/carbon.super/fs/gadget/Android_Battery_Level_Chart"; + var gadgetLocation = "/portal/store/carbon.super/fs/gadget/Android_Battery_History_Chart"; var PATH_SEPERATOR = "/"; if (gadgetLocation.search("store") != -1) { wso2.gadgets.identity.getTenantDomain(function (tenantDomain) { diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/thumbnail.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/thumbnail.png similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/thumbnail.png rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/Android_Battery_History_Chart/thumbnail.png diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/artifact.xml new file mode 100644 index 000000000..4e09e7d4b --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_history_chart_gadget/artifact.xml @@ -0,0 +1,23 @@ + + + + + Android_Battery_History_Chart + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/gadget.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/gadget.json deleted file mode 100644 index 73bd6d356..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/gadget.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "id": "Android_Battery_Level_Chart", - "title": "Android Battery Level Chart", - "type": "gadget", - "thumbnail": "gadget/Android_Battery_Level_Chart/thumbnail.png", - "data": { - "url": "gadget/Android_Battery_Level_Chart/gadget.xml" - } -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/provider-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/provider-client.js deleted file mode 100644 index 6196677f6..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/provider-client.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// var registerCallBackforPush; - -(function() { - - var callback; - - /** - * TODO Need to read hostname,port, and tenantId from providerConfig - * @param providerConfig - * @param schema - */ - registerCallBackforPush = function(providerConfig, schema, _callback) { - var streamId = providerConfig['streamName']; - var hostname = window.parent.location.hostname; - var port = window.parent.location.port; - - subscribe(streamId.split(":")[0], streamId.split(":")[1], - '10', - onData, onError, - hostname, - port, - 'WEBSOCKET' - ); - callback = _callback; - }; - - function onData(streamId, data) { - callback(data); - }; - - function onError(error) { - console.error(error); - }; - -}()); - diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/realtime-provider-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/realtime-provider-api.js deleted file mode 100644 index 7cf59af77..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/core/realtime-provider-api.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var getConfig, validate, getMode, getSchema, getData, registerCallBackforPush; - -(function() { - - var PROVIDERS_LOCATION = '/extensions/providers/'; - var PROVIDER_NAME = 'realtime'; - - var log = new Log(); - var utils = require('/modules/utils.js'); - var carbon = require("carbon"); - var EventPublisherConstants = Packages.org.wso2.carbon.event.publisher.core.config.EventPublisherConstants; - var eventPublisherService = carbon.server.osgiService('org.wso2.carbon.event.publisher.core.EventPublisherService'); - var eventStreamService = carbon.server.osgiService('org.wso2.carbon.event.stream.core.EventStreamService'); - - var typeMap = { - "bool": "string", - "boolean": "string", - "string": "string", - "int": "number", - "integer": "number", - "long": "number", - "double": "number", - "float": "number", - "time": "time" - }; - - getConfig = function() { - var formConfig = require(PROVIDERS_LOCATION + '/' + PROVIDER_NAME + '/config.json'); - var datasources = []; - try { - var eventPublisherConfigurationList = eventPublisherService.getAllActiveEventPublisherConfigurations(); - for (var i = 0; i < eventPublisherConfigurationList.size(); i++) { - var eventPublisherConfiguration = eventPublisherService.getActiveEventPublisherConfiguration( - eventPublisherConfigurationList.get(i).getEventPublisherName());; - - var mappingTypeIsWso2 = eventPublisherConfiguration.getOutputMapping() - .getMappingType().equals(EventPublisherConstants.EF_WSO2EVENT_MAPPING_TYPE); - - var adapterType = null; - if (eventPublisherConfiguration.getToAdapterConfiguration() != null) { - adapterType = eventPublisherConfiguration.getToAdapterConfiguration().getType(); - } - if (mappingTypeIsWso2 && adapterType.trim() == "ui") { - var streamName = eventPublisherConfiguration.getFromStreamName(); - var streamVersion = eventPublisherConfiguration.getFromStreamVersion(); - var streamId = streamName + ":" + streamVersion; - datasources.push(streamId); - } - } - var datasourceCfg = { - "fieldLabel": "Event Stream", - "fieldName": "streamName", - "fieldType": "dropDown" - }; - datasourceCfg['valueSet'] = datasources; - } catch (e) { - log.error(e); - } - formConfig.config.push(datasourceCfg); - return formConfig; - }; - - /** - * validate the user input of provider configuration - * @param providerConfig - */ - validate = function(providerConfig) { - /* - validate the form and return - - */ - return true; - }; - - /** - * returns the data mode either push or pull - */ - getMode = function() { - return 'push'; - }; - - /** - * returns an array of column names & types - * @param providerConfig - */ - getSchema = function(providerConfig) { - var streamId = providerConfig["streamName"]; - var output = []; - - output.push({ - fieldName: "TIMESTAMP", - fieldType: "time" - }); - - if (eventStreamService != null) { - var eventStreamConfiguration = eventStreamService.getEventStreamConfiguration(streamId); - if (eventStreamConfiguration != null) { - var metaData = eventStreamConfiguration.getStreamDefinition().getMetaData(); - var correlationData = eventStreamConfiguration.getStreamDefinition().getCorrelationData(); - var payloadData = eventStreamConfiguration.getStreamDefinition().getPayloadData(); - if (metaData != null) { - for (var i = 0; i < metaData.size(); i++) { - var type = metaData.get(i).getType().toString().toLowerCase(); - output.push({ - fieldName: metaData.get(i).getName(), - fieldType: typeMap[type.toLowerCase()] - }); - } - } - if (correlationData != null) { - for (var i = 0; i < correlationData.size(); i++) { - var type = correlationData.get(i).getType().toString().toLowerCase(); - output.push({ - fieldName: correlationData.get(i).getName(), - fieldType: typeMap[type.toLowerCase()] - }); - } - } - if (payloadData != null) { - for (var i = 0; i < payloadData.size(); i++) { - var type = payloadData.get(i).getType().toString().toLowerCase(); - output.push({ - fieldName: payloadData.get(i).getName(), - fieldType: typeMap[type.toLowerCase()] - }); - } - } - } - } - return output; - }; - - getData = function(providerConfig,limit) { - var data = []; - return data; - }; - - -}()); diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/provider-libs/ws-client.js deleted file mode 100644 index 4c78cf9d1..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_Chart/js/provider-libs/ws-client.js +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -var CONSTANTS = { - urlSeperator: '/', - queryParamStreamName : '?streamname=', - queryParamStreamVersion : '&version=', - queryParamLastUpdatedTime : '&lastUpdatedTime=', - urlSecureTransportWebsocket : 'wss://', - urlSecureTransportHttp : 'https://', - colon : ':', - defaultIntervalTime : 10 * 1000, - defaultHostName : 'localhost', - defaultSecurePortNumber : '9443', - defaultMode : 'AUTO', - processModeHTTP : 'HTTP', - processModeWebSocket : 'WEBSOCKET', - processModeAuto : 'AUTO', - numThousand : 1000, - websocketTimeAppender : 400, - websocketSubscriptionEndpoint : 'portal/uipublisher/websocketSubscriptionEndpoint.jag', - httpEventRetrievalEndpoint : 'portal/uipublisher/httpEventRetrievalEndpoint.jag' -}; - - -var websocket = null; -var webSocketUrl; -var httpUrl; -var cepHostName; -var cepPortNumber; -var isErrorOccured = false; -var lastUpdatedtime = -1; -var polingInterval; -var stream; -var streamVersion; -var firstPollingAttempt; -var processMode; -var onSuccessFunction; -var onErrorFunction; -var terminateWebsocketInstance = false; -var pollingContinue = true; - -function subscribe(streamName,version,intervalTime, - listeningFuncSuccessData,listeningFuncErrorData,cepHost,cepPort,mode){ - stopPollingProcesses(); - stream = streamName; - streamVersion = version; - onSuccessFunction = listeningFuncSuccessData; - onErrorFunction = listeningFuncErrorData; - - if(intervalTime == null || intervalTime == ""){ - polingInterval = CONSTANTS.defaultIntervalTime; - } else{ - polingInterval = intervalTime * CONSTANTS.numThousand; - } - - if(cepHost == null || cepHost == ""){ - cepHostName = CONSTANTS.defaultHostName; - } else{ - cepHostName = cepHost; - } - - if(cepPort == null || cepPort == ""){ - cepPortNumber = CONSTANTS.defaultSecurePortNumber; - } else{ - cepPortNumber = cepPort; - } - - if(mode == null || mode == ""){ - processMode = CONSTANTS.defaultMode; - } else{ - processMode = mode; - } - - webSocketUrl = CONSTANTS.urlSecureTransportWebsocket + cepHostName + CONSTANTS.colon + cepPortNumber + - CONSTANTS.urlSeperator + CONSTANTS.websocketSubscriptionEndpoint; - - if(processMode == CONSTANTS.processModeHTTP){ - firstPollingAttempt = true; - pollingContinue = true; - startPoll(); - } else{ - initializeWebSocket(webSocketUrl); - } -} - - -/** - * Initializing Web Socket - */ -function initializeWebSocket(webSocketUrl){ - websocket = new WebSocket(webSocketUrl); - websocket.onopen = webSocketOnOpen; - websocket.onmessage = webSocketOnMessage; - websocket.onclose = webSocketOnClose; - websocket.onerror = webSocketOnError; -} - -function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProperties, streamValues) { - if (streamProperties.length === streamValues.length) { - var message = {}; - message.streamName = streamName; - message.streamVersion = streamVersion; - var i; - for (i = 0; i < streamProperties.length; i++) { - message.filterProps = []; - message.filterProps.push({ - 'name': streamProperties[i], - 'value': streamValues[i] - }); - } - return JSON.stringify(message); - } else { - console.log('stream properties and values are not in equal size'); - } -} - -/** - * Web socket On Open - */ - -var webSocketOnOpen = function () { - var filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; - var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); - websocket.send(data); -}; - - -/** - * On server sends a message - */ -var webSocketOnMessage = function (evt) { - var event = evt.data; - var array = JSON.parse(event); - constructPayload(array); -}; - -/** - * On server close - */ -var webSocketOnClose =function (e) { - - if(isErrorOccured){ - if(processMode != CONSTANTS.processModeWebSocket){ - firstPollingAttempt = true; - pollingContinue = true; - startPoll(); - } - } else{ - if(!terminateWebsocketInstance){ - waitForSocketConnection(websocket); - } else{ - terminateWebsocketInstance = false; - } - - } -}; - -/** - * On server Error - */ -var webSocketOnError = function (err) { - var error = "Error: Cannot connect to Websocket URL:" + webSocketUrl + " .Hence closing the connection!"; - - onErrorFunction(error); - isErrorOccured = true; - -}; - -/** - * Gracefully increments the connection retry - */ -var waitTime = CONSTANTS.numThousand; -function waitForSocketConnection(socket, callback){ - setTimeout( - function () { - if (socket.readyState === 1) { - initializeWebSocket(webSocketUrl); - console.log("Connection is made"); - if(callback != null){ - callback(); - } - return; - } else { - websocket = new WebSocket(webSocketUrl); - waitTime += CONSTANTS.websocketTimeAppender; - waitForSocketConnection(websocket, callback); - } - }, waitTime); -} - -/** - * Polling to retrieve events from http request periodically - */ -function startPoll(){ - - (function poll(){ - setTimeout(function(){ - httpUrl = CONSTANTS.urlSecureTransportHttp + cepHostName + CONSTANTS.colon + cepPortNumber + - CONSTANTS.urlSeperator + CONSTANTS.httpEventRetrievalEndpoint + CONSTANTS.queryParamStreamName + stream + - CONSTANTS.queryParamStreamVersion + streamVersion + CONSTANTS.queryParamLastUpdatedTime + lastUpdatedtime;; - $.getJSON(httpUrl, function(responseText) { - if(firstPollingAttempt){ - /*var data = $("textarea#idConsole").val(); - $("textarea#idConsole").val(data + "Successfully connected to HTTP.");*/ - firstPollingAttempt = false; - } - var eventList = $.parseJSON(responseText.events); - if(eventList.length != 0){ - lastUpdatedtime = responseText.lastEventTime; - for(var i=0;i + + true + AndriodCallScript + + 0 0/5 * * * ? + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_script/artifact.xml similarity index 81% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/artifact.xml rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_script/artifact.xml index 4128fdf2c..ef0064603 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/artifact.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_script/artifact.xml @@ -17,7 +17,7 @@ ~ under the License. --> - - Android_Battery_Level_Chart + + AndroidBatteryScript.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/artifact.xml new file mode 100644 index 000000000..41994b061 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/artifact.xml @@ -0,0 +1,24 @@ + + + + + org_wso2_iot_android_battery_stats.xml + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/org_wso2_iot_android_battery_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/org_wso2_iot_android_battery_stats.xml new file mode 100755 index 000000000..143d5d53d --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_event_sink/org_wso2_iot_android_battery_stats.xml @@ -0,0 +1,106 @@ + + + + + meta_owner + false + false + false + false + STRING + + + meta_deviceId + false + false + false + false + STRING + + + meta_timestamp + false + false + false + false + LONG + + + level + false + false + false + false + INTEGER + + + state + false + false + false + false + STRING + + + status + false + false + false + false + LONG + + + temperature + false + false + false + false + INTEGER + + + year + false + false + false + false + INTEGER + + + month + false + false + false + false + INTEGER + + + day + false + false + false + false + INTEGER + + + hour + false + false + false + false + INTEGER + + + minute + false + false + false + false + INTEGER + + + + org.wso2.iot.android.battery.stats:1.0.0 + + false + PROCESSED_DATA_STORE + \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/artifact.xml new file mode 100644 index 000000000..56cda93fd --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/artifact.xml @@ -0,0 +1,23 @@ + + + + + org.wso2.iot.android.battery.stats_1.0.0.json + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/org.wso2.iot.android.battery.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/org.wso2.iot.android.battery.stats_1.0.0.json new file mode 100755 index 000000000..7879b1317 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_streams/org.wso2.iot.android.battery.stats_1.0.0.json @@ -0,0 +1,58 @@ +{ + "name": "org.wso2.iot.android.battery.stats", + "version": "1.0.0", + "nickName": "", + "description": "", + "metaData": [ + { + "name": "owner", + "type": "STRING" + }, + { + "name": "deviceId", + "type": "STRING" + }, + { + "name": "timestamp", + "type": "LONG" + } + ], + "payloadData": [ + { + "name": "level", + "type": "INT" + }, + { + "name": "state", + "type": "STRING" + }, + { + "name": "status", + "type": "STRING" + }, + { + "name": "temperature", + "type": "INT" + }, + { + "name": "year", + "type": "INT" + }, + { + "name": "month", + "type": "INT" + }, + { + "name": "day", + "type": "INT" + }, + { + "name": "hour", + "type": "INT" + }, + { + "name": "minute", + "type": "INT" + } + ] +} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_ui_event_publisher/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_ui_event_publisher/artifact.xml new file mode 100644 index 000000000..d95e208cf --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_ui_event_publisher/artifact.xml @@ -0,0 +1,24 @@ + + + + + org.wso2.iot.android.battery.stats.ui.publisher.xml + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_ui_event_publisher/org.wso2.iot.android.battery.stats.ui.publisher.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_ui_event_publisher/org.wso2.iot.android.battery.stats.ui.publisher.xml new file mode 100644 index 000000000..f75b4f49f --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_stats_ui_event_publisher/org.wso2.iot.android.battery.stats.ui.publisher.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_map_gadget/Android_Location_Map/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_map_gadget/Android_Location_Map/js/provider-libs/ws-client.js index 8757e44dc..c4b8a7dea 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_map_gadget/Android_Location_Map/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_map_gadget/Android_Location_Map/js/provider-libs/ws-client.js @@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * Get the parameters as query parameters. + * This method parses those parameters and returns. + * */ +function getAllQueryParamsFromURL() { + var queryParamList = {}, qParam; + var urlQueryString = decodeURIComponent(window.top.location.search.substring(1)); + + if (urlQueryString) { + var queryStringPairs = urlQueryString.split('&'); + for (var i = 0; i < queryStringPairs.length; i++) { + qParam = queryStringPairs[i].split('='); + queryParamList[qParam[0]] = qParam[1]; + } + return queryParamList; + + } else { + return null; + } +} + /** * Web socket On Open */ - var webSocketOnOpen = function () { - var filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; - var data = getWebsocketSubscriptionMessage(stream, streamVersion, [], []); + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params != null) { + owner = params["owner"]; + deviceId = params["deviceId"]; + + } + var filterPropNames = ["meta_owner", "meta_deviceId"]; + var filterPropVals = [owner, deviceId]; + var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); websocket.send(data); }; - /** * On server sends a message */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_audio_gadget/Android_Realtime_Audio/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_audio_gadget/Android_Realtime_Audio/js/provider-libs/ws-client.js index 4c78cf9d1..ab7263155 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_audio_gadget/Android_Realtime_Audio/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_audio_gadget/Android_Realtime_Audio/js/provider-libs/ws-client.js @@ -130,18 +130,44 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * Get the parameters as query parameters. + * This method parses those parameters and returns. + * */ +function getAllQueryParamsFromURL() { + var queryParamList = {}, qParam; + var urlQueryString = decodeURIComponent(window.top.location.search.substring(1)); + + if (urlQueryString) { + var queryStringPairs = urlQueryString.split('&'); + for (var i = 0; i < queryStringPairs.length; i++) { + qParam = queryStringPairs[i].split('='); + queryParamList[qParam[0]] = qParam[1]; + } + return queryParamList; + + } else { + return null; + } +} + /** * Web socket On Open */ - var webSocketOnOpen = function () { - var filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params) { + owner = params["owner"]; + deviceId = params["deviceId"]; + } + var filterPropNames = ["meta_owner", "meta_deviceId"]; + var filterPropVals = [owner, deviceId]; var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); websocket.send(data); }; - /** * On server sends a message */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_battery_gadget/Android_Realtime_Battery/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_battery_gadget/Android_Realtime_Battery/js/provider-libs/ws-client.js index 4c78cf9d1..ab7263155 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_battery_gadget/Android_Realtime_Battery/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_battery_gadget/Android_Realtime_Battery/js/provider-libs/ws-client.js @@ -130,18 +130,44 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * Get the parameters as query parameters. + * This method parses those parameters and returns. + * */ +function getAllQueryParamsFromURL() { + var queryParamList = {}, qParam; + var urlQueryString = decodeURIComponent(window.top.location.search.substring(1)); + + if (urlQueryString) { + var queryStringPairs = urlQueryString.split('&'); + for (var i = 0; i < queryStringPairs.length; i++) { + qParam = queryStringPairs[i].split('='); + queryParamList[qParam[0]] = qParam[1]; + } + return queryParamList; + + } else { + return null; + } +} + /** * Web socket On Open */ - var webSocketOnOpen = function () { - var filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params) { + owner = params["owner"]; + deviceId = params["deviceId"]; + } + var filterPropNames = ["meta_owner", "meta_deviceId"]; + var filterPropVals = [owner, deviceId]; var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); websocket.send(data); }; - /** * On server sends a message */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_call_gadget/Android_Realtime_Call/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_call_gadget/Android_Realtime_Call/js/provider-libs/ws-client.js index 61bc55543..85f23c101 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_call_gadget/Android_Realtime_Call/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_call_gadget/Android_Realtime_Call/js/provider-libs/ws-client.js @@ -130,18 +130,44 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * Get the parameters as query parameters. + * This method parses those parameters and returns. + * */ +function getAllQueryParamsFromURL() { + var queryParamList = {}, qParam; + var urlQueryString = decodeURIComponent(window.top.location.search.substring(1)); + + if (urlQueryString) { + var queryStringPairs = urlQueryString.split('&'); + for (var i = 0; i < queryStringPairs.length; i++) { + qParam = queryStringPairs[i].split('='); + queryParamList[qParam[0]] = qParam[1]; + } + return queryParamList; + + } else { + return null; + } +} + /** * Web socket On Open */ - var webSocketOnOpen = function () { - var filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params) { + owner = params["owner"]; + deviceId = params["deviceId"]; + } + var filterPropNames = ["meta_owner", "meta_deviceId"]; + var filterPropVals = [owner, deviceId]; var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); websocket.send(data); }; - /** * On server sends a message */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_data_gadget/Android_Realtime_Data/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_data_gadget/Android_Realtime_Data/js/provider-libs/ws-client.js index 4c78cf9d1..ab7263155 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_data_gadget/Android_Realtime_Data/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_data_gadget/Android_Realtime_Data/js/provider-libs/ws-client.js @@ -130,18 +130,44 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * Get the parameters as query parameters. + * This method parses those parameters and returns. + * */ +function getAllQueryParamsFromURL() { + var queryParamList = {}, qParam; + var urlQueryString = decodeURIComponent(window.top.location.search.substring(1)); + + if (urlQueryString) { + var queryStringPairs = urlQueryString.split('&'); + for (var i = 0; i < queryStringPairs.length; i++) { + qParam = queryStringPairs[i].split('='); + queryParamList[qParam[0]] = qParam[1]; + } + return queryParamList; + + } else { + return null; + } +} + /** * Web socket On Open */ - var webSocketOnOpen = function () { - var filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params) { + owner = params["owner"]; + deviceId = params["deviceId"]; + } + var filterPropNames = ["meta_owner", "meta_deviceId"]; + var filterPropVals = [owner, deviceId]; var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); websocket.send(data); }; - /** * On server sends a message */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_screen_gadget/Android_Realtime_Screen/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_screen_gadget/Android_Realtime_Screen/js/provider-libs/ws-client.js index 4c78cf9d1..ab7263155 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_screen_gadget/Android_Realtime_Screen/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_screen_gadget/Android_Realtime_Screen/js/provider-libs/ws-client.js @@ -130,18 +130,44 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * Get the parameters as query parameters. + * This method parses those parameters and returns. + * */ +function getAllQueryParamsFromURL() { + var queryParamList = {}, qParam; + var urlQueryString = decodeURIComponent(window.top.location.search.substring(1)); + + if (urlQueryString) { + var queryStringPairs = urlQueryString.split('&'); + for (var i = 0; i < queryStringPairs.length; i++) { + qParam = queryStringPairs[i].split('='); + queryParamList[qParam[0]] = qParam[1]; + } + return queryParamList; + + } else { + return null; + } +} + /** * Web socket On Open */ - var webSocketOnOpen = function () { - var filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params) { + owner = params["owner"]; + deviceId = params["deviceId"]; + } + var filterPropNames = ["meta_owner", "meta_deviceId"]; + var filterPropVals = [owner, deviceId]; var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); websocket.send(data); }; - /** * On server sends a message */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_sms_gadget/Android_Realtime_SMS/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_sms_gadget/Android_Realtime_SMS/js/provider-libs/ws-client.js index e62c073ba..357c2995b 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_sms_gadget/Android_Realtime_SMS/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_sms_gadget/Android_Realtime_SMS/js/provider-libs/ws-client.js @@ -130,18 +130,44 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * Get the parameters as query parameters. + * This method parses those parameters and returns. + * */ +function getAllQueryParamsFromURL() { + var queryParamList = {}, qParam; + var urlQueryString = decodeURIComponent(window.top.location.search.substring(1)); + + if (urlQueryString) { + var queryStringPairs = urlQueryString.split('&'); + for (var i = 0; i < queryStringPairs.length; i++) { + qParam = queryStringPairs[i].split('='); + queryParamList[qParam[0]] = qParam[1]; + } + return queryParamList; + + } else { + return null; + } +} + /** * Web socket On Open */ - var webSocketOnOpen = function () { - var filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params) { + owner = params["owner"]; + deviceId = params["deviceId"]; + } + var filterPropNames = ["meta_owner", "meta_deviceId"]; + var filterPropVals = [owner, deviceId]; var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); websocket.send(data); }; - /** * On server sends a message */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_dashboard/android-iot.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_dashboard/android-iot.json index ec1c155ba..6be9afa05 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_dashboard/android-iot.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_dashboard/android-iot.json @@ -586,9 +586,9 @@ { "content": { "data": { - "url": "fs://gadget/Android_Battery_Level_Chart/gadget.xml" + "url": "fs://gadget/Android_Battery_History_Chart/gadget.xml" }, - "id": "Android_Battery_Level_Chart", + "id": "Android_Battery_History_Chart", "locale_titles": { "en-US": "History" }, @@ -611,11 +611,11 @@ "title": "History", "titlePosition": "center" }, - "thumbnail": "fs://gadget/Android_Battery_Level_Chart/thumbnail.png", - "title": "Android Battery Level Chart", + "thumbnail": "fs://gadget/Android_Battery_History_Chart/thumbnail.png", + "title": "Android Battery Hisory Chart", "type": "gadget" }, - "id": "Android_Battery_Level_Chart-0" + "id": "Android_Battery_History_Chart-0" } ], "e": [ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml index 67abcb7a0..688db7abc 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml @@ -38,6 +38,8 @@ serverRole="DataAnalyticsServer"/> + + + + + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index 8286f4838..23784a922 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -3,7 +3,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseServiceImpl.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseServiceImpl.java index 72ccc6fe8..5a4b65ddb 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseServiceImpl.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseServiceImpl.java @@ -280,11 +280,7 @@ public class AndroidSenseServiceImpl implements AndroidSenseService { if (added) { AndroidConfiguration androidConfiguration = new AndroidConfiguration(); androidConfiguration.setTenantDomain(APIUtil.getAuthenticatedUserTenantDomain()); - String mqttEndpoint = DEFAULT_MQTT_ENDPOINT; - if (mqttEndpoint.contains(AndroidSenseConstants.LOCALHOST)) { - mqttEndpoint = mqttEndpoint.replace(AndroidSenseConstants.LOCALHOST, APIUtil.getServerUrl()); - } - androidConfiguration.setMqttEndpoint(mqttEndpoint); + androidConfiguration.setMqttEndpoint(APIUtil.getMqttEndpoint()); return Response.ok(androidConfiguration.toString()).build(); } else { return Response.status(Response.Status.NOT_ACCEPTABLE.getStatusCode()).entity(false).build(); diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml index 0f937b386..39d72ac61 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml @@ -22,7 +22,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.js index feb70be8b..312961852 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view/analytics-view.js @@ -17,26 +17,9 @@ */ function onRequest(context) { - var devices = context.unit.params.devices; - var deviceType = context.uriParams.deviceType; + var user = context.user; var deviceId = request.getParameter("deviceId"); - if (devices) { - return { - "devices": stringify(devices), - "backendApiUri": "/android_sense/stats/" - }; - } else if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) { - var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; - var device = deviceModule.viewDevice(deviceType, deviceId); - if (device && device.status != "error") { - return { - "device": device.content, - "backendApiUrl": "/android_sense/stats/" + deviceId + "/sensors/" - }; - } else { - response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); - exit(); - } - } + //Redirects to the portal app as we do not use the old analytics view. + response.sendRedirect(context.app.conf["portalURL"] + "/portal/dashboards/android-iot/real-time?owner=" + user.username + "&deviceId=" + deviceId); } \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs index 5e940f349..ba9322aca 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs @@ -41,8 +41,6 @@ data-toggle="tab" aria-controls="device_statistics">Device Statistics -
  • Device Location
  • Operations Log
  • {{/zone}} @@ -53,15 +51,6 @@
    Device Statistics
    {{unit "cdmf.unit.device.type.android_sense.realtime.analytics-view" device=device}} -
    -
    Device Location
    -
    -
    -
    -
    -
    -
    Operations Log
    {{/zone}} - -{{#zone "bottomJs"}} - -{{/zone}} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs index 86735e8ce..02f753c9f 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs @@ -19,98 +19,7 @@
    -
    -
    -
    Battery
    -
    -
    -
    -
    -
    -
    Time
    -
    -
    -
    Light
    -
    -
    -
    -
    -
    -
    Time
    -
    - -
    -
    Pressure
    -
    -
    -
    -
    -
    -
    Time
    -
    - -
    -
    Proximity
    -
    -
    -
    -
    -
    -
    Time
    -
    - -
    -
    Accelerometer
    -
    -
    -
    -
    -
    -
    Time
    -
    - -
    -
    Magnetic
    -
    -
    -
    -
    -
    -
    Time
    -
    - -
    -
    Rotation
    -
    -
    -
    -
    -
    -
    Time
    -
    - -
    -
    Gyroscope
    -
    -
    -
    -
    -
    -
    Time
    -
    - -
    -
    Gravity
    -
    -
    -
    -
    -
    -
    Time
    -
    - -
    diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/asset/androidsense.apk b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/asset/androidsense.apk index 4f9cadd6c..83c7cee6b 100644 Binary files a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/asset/androidsense.apk and b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/public/asset/androidsense.apk differ diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index 22d804017..2050726a6 100644 --- a/components/device-types/androidsense-plugin/pom.xml +++ b/components/device-types/androidsense-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml index c099adc19..3897b97f3 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index 947cbc402..3a4498740 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml index 8d1c6bfee..009bafbda 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml @@ -23,7 +23,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index 4229aa52c..582e3404a 100644 --- a/components/device-types/arduino-plugin/pom.xml +++ b/components/device-types/arduino-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index fc9a12f9f..1a33a18fd 100644 --- a/components/device-types/pom.xml +++ b/components/device-types/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml index 5f80e0a91..b989d4582 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index 07b51b8fd..9da643b65 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml index 5ef72e16c..347fa7328 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml @@ -23,7 +23,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index 87853cab1..11aadb0ff 100644 --- a/components/device-types/raspberrypi-plugin/pom.xml +++ b/components/device-types/raspberrypi-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/pom.xml index c1cbe925b..57c3eb3a2 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml index c2c197b1b..2e6be1e5b 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml index d4573ade7..ffa239d28 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml index e0a71eada..0b92cd817 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml index 1da943916..b9fc963bc 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml index 928fd39bd..9adb1043e 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/pom.xml index 45cc1029c..5e66e4da4 100644 --- a/components/device-types/virtual-fire-alarm-plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml index 843833d9c..48a534775 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml @@ -18,7 +18,7 @@ org.wso2.carbon.devicemgt-plugins appm-connector - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java index 766698c9c..607570bd0 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java @@ -73,8 +73,12 @@ public class ApplicationOperationsImpl implements ApplicationOperations { getDevicesOfUser(userName); for (org.wso2.carbon.device.mgt.common.Device device : deviceList) { - if(applicationOperationAction.getApp().getPlatform().equalsIgnoreCase(device.getType())){ - deviceIdentifiers.add(getDeviceIdentifierByDevice(device)); + if(MDMAppConstants.WEBAPP.equals(applicationOperationAction.getApp().getPlatform()) || + applicationOperationAction.getApp().getPlatform().equalsIgnoreCase(device.getType())){ + if (MDMAppConstants.ACTIVE.equalsIgnoreCase(device.getEnrolmentInfo(). + getStatus().toString())) { + deviceIdentifiers.add(getDeviceIdentifierByDevice(device)); + } } } } @@ -95,7 +99,9 @@ public class ApplicationOperationsImpl implements ApplicationOperations { getAllDevicesOfRole(userRole); for (org.wso2.carbon.device.mgt.common.Device device : deviceList) { - deviceIdentifiers.add(getDeviceIdentifierByDevice(device)); + if (MDMAppConstants.ACTIVE.equalsIgnoreCase(device.getEnrolmentInfo().getStatus().toString())) { + deviceIdentifiers.add(getDeviceIdentifierByDevice(device)); + } } } } catch (DeviceManagementException devMgtEx) { @@ -176,8 +182,11 @@ public class ApplicationOperationsImpl implements ApplicationOperations { operation = IOSApplicationOperationUtil.createInstallAppOperation(mobileApp); } else { - operation = - IOSApplicationOperationUtil.createAppUninstallOperation(mobileApp); + if (MDMAppConstants.WEBAPP.equals(app.getPlatform())) { + operation = IOSApplicationOperationUtil.createWebClipUninstallOperation(mobileApp); + } else { + operation = IOSApplicationOperationUtil.createAppUninstallOperation(mobileApp); + } } } activity = MDMServiceAPIUtils.getAppManagementService(applicationOperationAction.getTenantId()) @@ -225,11 +234,21 @@ public class ApplicationOperationsImpl implements ApplicationOperations { throws MobileApplicationException { List devices; + List deviceList = null; try { - List deviceList = MDMServiceAPIUtils - .getDeviceManagementService(applicationOperationDevice.getTenantId()). - getDevicesOfUser( - applicationOperationDevice.getCurrentUser().getUsername()); + if(MDMAppConstants.WEBAPP.equals + (applicationOperationDevice.getPlatform())) { + deviceList = MDMServiceAPIUtils + .getDeviceManagementService(applicationOperationDevice.getTenantId()). + getDevicesOfUser( + applicationOperationDevice.getCurrentUser().getUsername()); + } else { + deviceList = MDMServiceAPIUtils + .getDeviceManagementService(applicationOperationDevice.getTenantId()). + getDevicesOfUser( + applicationOperationDevice.getCurrentUser().getUsername(), + applicationOperationDevice.getPlatform()); + } devices = new ArrayList<>(deviceList.size()); if(log.isDebugEnabled()){ log.debug("device list got from mdm "+ deviceList.toString()); diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java index 22c7963de..d5ae92170 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java @@ -23,6 +23,15 @@ import java.io.Serializable; public class RemoveApplication implements Serializable { private String bundleId; + private String url; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } public String getBundleId() { return bundleId; diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java index 5b2dec4eb..6adb9fe09 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java @@ -111,4 +111,21 @@ public class IOSApplicationOperationUtil { return operation; } + /** + * Create uninstall operations for webclip. + * + * @param application + * @return Uninstall operation + * @throws DeviceApplicationException + */ + public static Operation createWebClipUninstallOperation(MobileApp application) throws + DeviceApplicationException { + ProfileOperation operation = new ProfileOperation(); + operation.setCode(MDMAppConstants.IOSConstants.OPCODE_REMOVE_APPLICATION); + operation.setType(Operation.Type.PROFILE); + RemoveApplication removeApplication = new RemoveApplication(); + removeApplication.setUrl(application.getIdentifier()); + operation.setPayLoad(removeApplication.toJSON()); + return operation; + } } diff --git a/components/extensions/appm-connector/pom.xml b/components/extensions/appm-connector/pom.xml index 74f4d2761..5a80d1e58 100644 --- a/components/extensions/appm-connector/pom.xml +++ b/components/extensions/appm-connector/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml index 3c5829536..689e601e7 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml index da3ebb907..04b039ca5 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml index faf76ef31..1103ae546 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml index b13546dcc..66407a234 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml index cf011f764..80abfed68 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml index 704b42182..8af82f5e4 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index 45eb9f50c..d69cd4e82 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml index 8fb8e44e7..15db750fd 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index 9ae557fcb..0d1ce685d 100644 --- a/components/extensions/cdmf-transport-adapters/pom.xml +++ b/components/extensions/cdmf-transport-adapters/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml index 0769aa3e6..67f14961f 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index 9c82f3955..4e1730cc3 100644 --- a/components/extensions/mb-extensions/pom.xml +++ b/components/extensions/mb-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index 15dc85a5a..8239a17de 100644 --- a/components/extensions/pom.xml +++ b/components/extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml index b1671cc44..818342bfa 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml @@ -15,13 +15,12 @@ ~ limitations under the License. --> - + org.wso2.carbon.devicemgt-plugins siddhi-extensions - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index 39b9741fe..5f506cb84 100644 --- a/components/extensions/siddhi-extensions/pom.xml +++ b/components/extensions/siddhi-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.hbs b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.hbs new file mode 100644 index 000000000..8cfcbeed3 --- /dev/null +++ b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.hbs @@ -0,0 +1,85 @@ +{{! + Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + + WSO2 Inc. licenses this file to you under the Apache License, + Version 2.0 (the "License"); you may not use this file except + in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +}} +{{#zone "topCss"}} + +{{/zone}} + +{{#zone "device-thumbnail"}} + +{{/zone}} + +{{#zone "device-opetations"}} +
    + Operations +
    +
    + {{unit "iot.unit.device.operation-bar" device=device backendApiUri=backendApiUri autoCompleteParams=autoCompleteParams}} +
    +{{/zone}} + +{{#zone "device-detail-properties"}} +
    + +
    +
    + +
    +
    Device Statistics
    + {{unit "cdmf.unit.device.type.raspberrypi.realtime.analytics-view" device=device}} +
    +
    +
    Operations Log
    +
    + +
    +
    + Not available yet +
    +
    +
    +
    +
    +
    +
    +
    +{{/zone}} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml index 0cebffd07..c4b30ab25 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins android-plugin - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index 0b1499ff9..8b6f4d71c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java index ddcf2a49d..4ca9b9b44 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java @@ -276,25 +276,52 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @Path("/{id}") @Override public Response modifyEnrollment(@PathParam("id") String id, @Valid AndroidDevice androidDevice) { - Device device = new Device(); - String msg = ""; - device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - if(androidDevice.getEnrolmentInfo().getDateOfEnrolment() <= 0){ - msg = "Invalid Enrollment date."; - return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + Device device; + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(id); + deviceIdentifier.setType(AndroidConstants.DEVICE_TYPE_ANDROID); + try { + device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); + } catch (DeviceManagementException e) { + String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" + + id + "'"; + log.error(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); } - if(androidDevice.getEnrolmentInfo().getDateOfLastUpdate() <= 0){ - msg = "Invalid Last Updated date."; - return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + + if (androidDevice == null) { + String errorMessage = "The payload of the android device enrollment is incorrect."; + log.error(errorMessage); + throw new org.wso2.carbon.mdm.services.android.exception.BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + if (device == null) { + String errorMessage = "The device to be modified doesn't exist."; + log.error(errorMessage); + throw new org.wso2.carbon.mdm.services.android.exception.NotFoundException( + new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage(errorMessage).build()); + } + if(androidDevice.getEnrolmentInfo() != null){ + device.setEnrolmentInfo(device.getEnrolmentInfo()); } - device.setEnrolmentInfo(androidDevice.getEnrolmentInfo()); device.getEnrolmentInfo().setOwner(AndroidAPIUtils.getAuthenticatedUser()); - device.setDeviceInfo(androidDevice.getDeviceInfo()); + if(androidDevice.getDeviceInfo() != null) { + device.setDeviceInfo(androidDevice.getDeviceInfo()); + } device.setDeviceIdentifier(androidDevice.getDeviceIdentifier()); - device.setDescription(androidDevice.getDescription()); - device.setName(androidDevice.getName()); - device.setFeatures(androidDevice.getFeatures()); - device.setProperties(androidDevice.getProperties()); + if(androidDevice.getDescription() != null) { + device.setDescription(androidDevice.getDescription()); + } + if(androidDevice.getName() != null) { + device.setName(androidDevice.getName()); + } + if(androidDevice.getFeatures() != null) { + device.setFeatures(androidDevice.getFeatures()); + } + if(androidDevice.getProperties() != null) { + device.setProperties(androidDevice.getProperties()); + } boolean result; try { device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); @@ -313,7 +340,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { return Response.status(Response.Status.NOT_MODIFIED).entity(responseMessage).build(); } } catch (DeviceManagementException e) { - msg = "Error occurred while modifying enrollment of the Android device that carries the id '" + + String msg = "Error occurred while modifying enrollment of the Android device that carries the id '" + id + "'"; log.error(msg, e); throw new UnexpectedServerErrorException( diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml index 83cadb58b..dc4e7098f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml @@ -23,13 +23,13 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT WSO2 Carbon - Mobile Android UI pom diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk new file mode 100755 index 000000000..62abf46b6 Binary files /dev/null and b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/android-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk differ diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.hbs deleted file mode 100644 index ae9864018..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.hbs +++ /dev/null @@ -1,32 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. licenses this file to you under the Apache License, - Version 2.0 (the "License"); you may not use this file except - in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -}} - -{{unit "cdmf.unit.device.type.android.date-range-picker"}} - -{{#zone "content"}} -
    - {{unit "cdmf.unit.device.type.android.operation-mod"}} -
    -{{/zone}} - -{{#zone "bottomJs"}} - - - {{js "js/operation-bar.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.js deleted file mode 100644 index 18541e4a9..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -function onRequest(context) { - var log = new Log("cdmf.unit.device.type.android.operation-bar"); - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var viewModel = {}; - var permissions = {}; - - // adding android operations related permission checks - permissions["android"] = []; - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/ring")) { - permissions["android"].push("DEVICE_RING"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/lock")) { - permissions["android"].push("DEVICE_LOCK"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/unlock")) { - permissions["android"].push("DEVICE_UNLOCK"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/location")) { - permissions["android"].push("DEVICE_LOCATION"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/clear-password")) { - permissions["android"].push("CLEAR_PASSWORD"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/reboot")) { - permissions["android"].push("DEVICE_REBOOT"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/upgrade-firmware")) { - permissions["android"].push("UPGRADE_FIRMWARE"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/mute")) { - permissions["android"].push("DEVICE_MUTE"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/send-notification")) { - permissions["android"].push("NOTIFICATION"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/change-lock-code")) { - permissions["android"].push("CHANGE_LOCK_CODE"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/enterprise-wipe")) { - permissions["android"].push("ENTERPRISE_WIPE"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/wipe")) { - permissions["android"].push("WIPE_DATA"); - } - - // adding ios operations related permission checks - permissions["ios"] = []; - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/lock")) { - permissions["ios"].push("DEVICE_LOCK"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/location")) { - permissions["ios"].push("LOCATION"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/enterprise-wipe")) { - permissions["ios"].push("ENTERPRISE_WIPE"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/notification")) { - permissions["ios"].push("NOTIFICATION"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/ring")) { - permissions["ios"].push("RING"); - } - - // adding windows operations related permission checks - permissions["windows"] = []; - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/lock")) { - permissions["windows"].push("DEVICE_LOCK"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/disenroll/windows")) { - permissions["windows"].push("DISENROLL"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/wipe")) { - permissions["windows"].push("WIPE_DATA"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/ring")) { - permissions["windows"].push("DEVICE_RING"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/lock-reset")) { - permissions["windows"].push("LOCK_RESET"); - } - - viewModel["permissions"] = stringify(permissions); - - viewModel["deviceType"] = context.unit.params.deviceType; - viewModel["ownership"] = context.unit.params.ownership; - - return viewModel; -} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.json deleted file mode 100644 index 688e93980..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/operation-bar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/js/operation-bar.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/js/operation-bar.js deleted file mode 100644 index 90ce9ce4a..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/js/operation-bar.js +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Setting-up global variables. - */ - -var operations = '.wr-operations', - modalPopup = '.modal', - modalPopupContent = modalPopup + ' .modal-content', - navHeight = $('#nav').height(), - headerHeight = $('header').height(), - offset = (headerHeight + navHeight), - deviceSelection = '.device-select', - platformTypeConstants = { - "ANDROID": "android", - "IOS": "ios", - "WINDOWS": "windows" - }, - ownershipTypeConstants = { - "BYOD": "BYOD", - "COPE": "COPE" - }, - operationBarModeConstants = { - "BULK": "BULK_OPERATION_MODE", - "SINGLE": "SINGLE_OPERATION_MODE" - }; - -/* - * Function to get selected devices ID's - */ -function getSelectedDeviceIds() { - var deviceIdentifierList = []; - $(deviceSelection).each(function (index) { - var device = $(this); - var deviceId = device.data('deviceid'); - var deviceType = device.data('type'); - deviceIdentifierList.push({ - "id": deviceId, - "type": deviceType - }); - }); - if (deviceIdentifierList.length == 0) { - var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable(); - thisTable.api().rows().every(function () { - if ($(this.node()).hasClass('DTTT_selected')) { - var deviceId = $(thisTable.api().row(this).node()).data('deviceid'); - var deviceType = $(thisTable.api().row(this).node()).data('devicetype'); - deviceIdentifierList.push({ - "id": deviceId, - "type": deviceType - }); - } - }); - } - - return deviceIdentifierList; -} - -/* - * On operation click function. - * @param selection: Selected operation - */ -function operationSelect(selection) { - var deviceIdList = getSelectedDeviceIds(); - if (deviceIdList == 0) { - $(modalPopupContent).html($("#errorOperations").html()); - } else { - $(modalPopupContent).addClass("operation-data"); - $(modalPopupContent).html($(operations + " .operation[data-operation-code=" + selection + "]").html()); - $(modalPopupContent).data("operation-code", selection); - } - showPopup(); -} - -function getDevicesByTypes(deviceList) { - var deviceTypes = {}; - $.each(deviceList, function (index, item) { - if (!deviceTypes[item.type]) { - deviceTypes[item.type] = []; - } - if (item.type == platformTypeConstants.ANDROID || - item.type == platformTypeConstants.IOS || item.type == platformTypeConstants.WINDOWS) { - deviceTypes[item.type].push(item.id); - } - }); - return deviceTypes; -} - -//function unloadOperationBar() { -// $("#showOperationsBtn").addClass("hidden"); -// $(".wr-operations").html(""); -//} - -function loadOperationBar(deviceType, ownership, mode) { - var operationBar = $("#operations-bar"); - var operationBarSrc = operationBar.attr("src"); - - $.template("operations-bar", operationBarSrc, function (template) { - var serviceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/*/features"; - invokerUtil.get( - serviceURL, - // success callback - function (data) { - var permittedOperations = []; - var i; - var permissionList = $("#operations-mod").data("permissions"); - var totalFeatures = JSON.parse(data); - for (i = 0; i < permissionList[deviceType].length; i++) { - var j; - for (j = 0; j < totalFeatures.length; j++) { - if (permissionList[deviceType][i] == totalFeatures[j]["code"]) { - if (deviceType == platformTypeConstants.ANDROID) { - if (totalFeatures[j]["code"] == "DEVICE_UNLOCK") { - if (ownership == ownershipTypeConstants.COPE) { - permittedOperations.push(totalFeatures[j]); - } - } else if (totalFeatures[j]["code"] == "WIPE_DATA") { - if (mode == operationBarModeConstants.BULK) { - if (ownership == ownershipTypeConstants.COPE) { - permittedOperations.push(totalFeatures[j]); - } - } else { - permittedOperations.push(totalFeatures[j]); - } - } else { - permittedOperations.push(totalFeatures[j]); - } - } else { - permittedOperations.push(totalFeatures[j]); - } - } - } - } - - var viewModel = {}; - permittedOperations = permittedOperations.filter(function (current) { - var iconName; - switch (deviceType) { - case platformTypeConstants.ANDROID: - iconName = operationModule.getAndroidIconForFeature(current.code); - break; - case platformTypeConstants.WINDOWS: - iconName = operationModule.getWindowsIconForFeature(current.code); - break; - case platformTypeConstants.IOS: - iconName = operationModule.getIOSIconForFeature(current.code); - break; - } - - /* adding ownership in addition to device-type - as it's vital in cases where UI for the same feature should change - according to ownership - */ - if (ownership) { - current.ownership = ownership; - } - - if (iconName) { - current.icon = iconName; - } - - return current; - }); - - viewModel.features = permittedOperations; - var content = template(viewModel); - $(".wr-operations").html(content); - }, - // error callback - function (message) { - $(".wr-operations").html(message); - }); - }); -} - -function runOperation(operationName) { - var deviceIdList = getSelectedDeviceIds(); - var list = getDevicesByTypes(deviceIdList); - - var successCallback = function (data) { - if (operationName == "NOTIFICATION") { - $(modalPopupContent).html($("#messageSuccess").html()); - } else { - $(modalPopupContent).html($("#operationSuccess").html()); - } - showPopup(); - }; - var errorCallback = function (data) { - $(modalPopupContent).html($("#errorOperationUnexpected").html()); - showPopup(); - }; - - var payload, serviceEndPoint; - if (list[platformTypeConstants.IOS]) { - payload = - operationModule.generatePayload(platformTypeConstants.IOS, operationName, list[platformTypeConstants.IOS]); - serviceEndPoint = operationModule.getIOSServiceEndpoint(operationName); - } else if (list[platformTypeConstants.ANDROID]) { - payload = operationModule - .generatePayload(platformTypeConstants.ANDROID, operationName, list[platformTypeConstants.ANDROID]); - serviceEndPoint = operationModule.getAndroidServiceEndpoint(operationName); - } else if (list[platformTypeConstants.WINDOWS]) { - payload = operationModule.generatePayload(platformTypeConstants.WINDOWS, operationName, - list[platformTypeConstants.WINDOWS]); - serviceEndPoint = operationModule.getWindowsServiceEndpoint(operationName); - } - if (operationName == "NOTIFICATION") { - var errorMsgWrapper = "#notification-error-msg"; - var errorMsg = "#notification-error-msg span"; - var messageTitle = $("#messageTitle").val(); - var messageText = $("#messageText").val(); - if (!(messageTitle && messageText)) { - $(errorMsg).text("Enter a message. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else { - invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback); - $(modalPopupContent).removeData(); - hidePopup(); - } - } else { - invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback); - $(modalPopupContent).removeData(); - hidePopup(); - } -} - -/* - * DOM ready functions. - */ -$(document).ready(function () { - $(operations).show(); -}); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-android.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-android.hbs deleted file mode 100644 index b92461ff7..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-android.hbs +++ /dev/null @@ -1,286 +0,0 @@ -
    - -
    - - -
    -
    - -
    -
    - -
    - Configure -
    -
    -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - -
    - -
    - -
    - -
    - - Configure -
    -
    -
    - - - -
    -
    - - -
    - -
    - - - -
    - -
    - Configure -
    - -
    - - -
    -
    - -
    - - -
    - -
    -
    - -
    - - -
    - -
    - Install -
    -
    -
    - -
    - - -
    - -
    - - -
    - -
    - Install -
    -
    -
    - -
    - - -
    - -
    - Uninstall -
    -
    -
    - - - -
    -
    - -
    -
    - -
    - Configure -
    -
    -
    - -
    -
    \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-ios.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-ios.hbs deleted file mode 100644 index 4cb006ef0..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/hidden-operations-ios.hbs +++ /dev/null @@ -1,366 +0,0 @@ -
    - -
    - - -
    -
    - -
    - -
    - -
    - -
    - -
    - - -
    - -
    -
    - - -
    -
    - - -
    - Install -
    - -
    -
    - -
    - -
    - -
    - -
    - -
    - - -
    - -
    -
    - - -
    -
    - - -
    - Install -
    -
    -
    - -
    - -
    - -
    - Uninstall -
    -
    -
    - - - -
    - - -
    - -
    - -
    - - -
    - -
    - - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - Configure -
    - - - -
    - - -
    - -
    - - - -
    -
    - -
    -
    - Path Prefix -
    -
    -
    - - - -
    - -
    - - - -
    - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - - - -
    -
    - -
    -
    - : -
    -
    -
    - - - -
    - -
    - - - -
    - -
    - - - -
    - -
    - -
    - - -
    -
    - - - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    - Configure -
    - - -
    - -
    - -
    - -
    - -
    AirPlay password -
    - -
    - Configure -
    - -
    -
    \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/operations.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/operations.hbs deleted file mode 100644 index 0b94ae088..000000000 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.old.operation-bar/public/templates/operations.hbs +++ /dev/null @@ -1,249 +0,0 @@ -
    - - - -
    -
    - - - -
    -
    - - - -
    - -
    - - - -
    -{{#each features}} - - - {{name}} - -
    - - - -
    -{{/each}} -
    \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js index b6b0795ca..a4272f442 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -16,17 +16,10 @@ * under the License. */ -var operationModule = function () { +var androidOperationModule = function () { var publicMethods = {}; var privateMethods = {}; - // Constants to define platform types available - var platformTypeConstants = { - "ANDROID": "android", - "IOS": "ios", - "WINDOWS": "windows" - }; - // Constants to define operation types available var operationTypeConstants = { "PROFILE": "profile", @@ -85,731 +78,8 @@ var operationModule = function () { "KIOSK_APPS_CODE": "KIOSK_APPS" }; - // Constants to define Windows Operation Constants - var windowsOperationConstants = { - "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", - "CAMERA_OPERATION_CODE": "CAMERA", - "ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE", - "NOTIFICATION_OPERATION_CODE": "NOTIFICATION", - "CHANGE_LOCK_CODE_OPERATION_CODE": "CHANGE_LOCK_CODE" - }; - - // Constants to define iOS Operation Constants - var iosOperationConstants = { - "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", - "RESTRICTIONS_OPERATION_CODE": "RESTRICTION", - "VPN_OPERATION_CODE": "VPN", - "WIFI_OPERATION_CODE": "WIFI", - "EMAIL_OPERATION_CODE": "EMAIL", - "AIRPLAY_OPERATION_CODE": "AIR_PLAY", - "LDAP_OPERATION_CODE": "LDAP", - "DOMAIN_OPERATION_CODE": "DOMAIN", - "CALENDAR_OPERATION_CODE": "CALDAV", - "NOTIFICATION_OPERATION_CODE": "NOTIFICATION", - "CALENDAR_SUBSCRIPTION_OPERATION_CODE": "CALENDAR_SUBSCRIPTION", - "APN_OPERATION_CODE": "APN", - "CELLULAR_OPERATION_CODE": "CELLULAR", - "PER_APP_VPN_OPERATION_CODE": "PER_APP_VPN", - "APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE": "APP_TO_PER_APP_VPN_MAPPING" - }; - - publicMethods.getIOSServiceEndpoint = function (operationCode) { - var featureMap = { - "DEVICE_LOCK": "lock", - "LOCATION": "location", - "ENTERPRISE_WIPE": "enterprise-wipe", - "NOTIFICATION": "notification", - "RING": "ring" - }; - return "/api/device-mgt/ios/v1.0/admin/devices/" + featureMap[operationCode]; - }; - - /** - * Convert the ios platform specific code to the generic payload. - * TODO: think of the possibility to follow a pattern to the key name (namespace?) - * @param operationCode - * @param operationPayload - * @returns {{}} - */ - privateMethods.generateGenericPayloadFromIOSPayload = function (operationCode, operationPayload) { - var payload = {}; - operationPayload = JSON.parse(operationPayload); - switch (operationCode) { - case iosOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - payload = { - "passcodePolicyForcePIN": operationPayload["forcePIN"], - "passcodePolicyAllowSimple": operationPayload["allowSimple"], - "passcodePolicyRequireAlphanumeric": operationPayload["requireAlphanumeric"], - "passcodePolicyMinLength": operationPayload["minLength"], - "passcodePolicyMinComplexChars": operationPayload["minComplexChars"], - "passcodePolicyMaxPasscodeAgeInDays": operationPayload["maxPINAgeInDays"], - "passcodePolicyPasscodeHistory": operationPayload["pinHistory"], - "passcodePolicyMaxAutoLock": operationPayload["maxInactivity"], - "passcodePolicyGracePeriod": operationPayload["maxGracePeriod"], - "passcodePolicyMaxFailedAttempts": operationPayload["maxFailedAttempts"] - }; - break; - case iosOperationConstants["DOMAIN_OPERATION_CODE"]: - payload = { - "emailDomains": operationPayload["emailDomains"], - "webDomains": operationPayload["webDomains"] - }; - break; - case iosOperationConstants["RESTRICTIONS_OPERATION_CODE"]: - payload = { - "restrictionsAllowAccountModification": operationPayload["allowAccountModification"], - "restrictionsAllowAddingGameCenterFriends": operationPayload["allowAddingGameCenterFriends"], - "restrictionsAllowAirDrop": operationPayload["allowAirDrop"], - "restrictionsAllowAppCellularDataModification": operationPayload["allowAppCellularDataModification"], - "restrictionsAllowAppInstallation": operationPayload["allowAppInstallation"], - "restrictionsAllowAppRemoval": operationPayload["allowAppRemoval"], - "restrictionsAllowAssistant": operationPayload["allowAssistant"], - "restrictionsAllowAssistantUserGeneratedContent": operationPayload["allowAssistantUserGeneratedContent"], - "restrictionsAllowAssistantWhileLocked": operationPayload["allowAssistantWhileLocked"], - "restrictionsAllowBookstore": operationPayload["allowBookstore"], - "restrictionsAllowBookstoreErotica": operationPayload["allowBookstoreErotica"], - "restrictionsAllowCamera": operationPayload["allowCamera"], - "restrictionsAllowChat": operationPayload["allowChat"], - "restrictionsAllowCloudBackup": operationPayload["allowCloudBackup"], - "restrictionsAllowCloudDocumentSync": operationPayload["allowCloudDocumentSync"], - "restrictionsAllowCloudKeychainSync": operationPayload["allowCloudKeychainSync"], - "restrictionsAllowDiagnosticSubmission": operationPayload["allowDiagnosticSubmission"], - "restrictionsAllowExplicitContent": operationPayload["allowExplicitContent"], - "restrictionsAllowFindMyFriendsModification": operationPayload["allowFindMyFriendsModification"], - "restrictionsAllowFingerprintForUnlock": operationPayload["allowFingerprintForUnlock"], - "restrictionsAllowGameCenter": operationPayload["allowGameCenter"], - "restrictionsAllowGlobalBackgroundFetchWhenRoaming": operationPayload["allowGlobalBackgroundFetchWhenRoaming"], - "restrictionsAllowInAppPurchases": operationPayload["allowInAppPurchases"], - "restrictionsAllowLockScreenControlCenter": operationPayload["allowLockScreenControlCenter"], - "restrictionsAllowHostPairing": operationPayload["allowHostPairing"], - "restrictionsAllowLockScreenNotificationsView": operationPayload["allowLockScreenNotificationsView"], - "restrictionsAllowLockScreenTodayView": operationPayload["allowLockScreenTodayView"], - "restrictionsAllowMultiplayerGaming": operationPayload["allowMultiplayerGaming"], - "restrictionsAllowOpenFromManagedToUnmanaged": operationPayload["allowOpenFromManagedToUnmanaged"], - "restrictionsAllowOpenFromUnmanagedToManaged": operationPayload["allowOpenFromUnmanagedToManaged"], - "restrictionsAllowOTAPKIUpdates": operationPayload["allowOTAPKIUpdates"], - "restrictionsAllowPassbookWhileLocked": operationPayload["allowPassbookWhileLocked"], - "restrictionsAllowPhotoStream": operationPayload["allowPhotoStream"], - "restrictionsAllowSafari": operationPayload["allowSafari"], - "restrictionsSafariAllowAutoFill": operationPayload["safariAllowAutoFill"], - "restrictionsSafariForceFraudWarning": operationPayload["safariForceFraudWarning"], - "restrictionsSafariAllowJavaScript": operationPayload["safariAllowJavaScript"], - "restrictionsSafariAllowPopups": operationPayload["safariAllowPopups"], - "restrictionsAllowScreenShot": operationPayload["allowScreenShot"], - "restrictionsAllowSharedStream": operationPayload["allowSharedStream"], - "restrictionsAllowUIConfigurationProfileInstallation": operationPayload["allowUIConfigurationProfileInstallation"], - "restrictionsAllowUntrustedTLSPrompt": operationPayload["allowUntrustedTLSPrompt"], - "restrictionsAllowVideoConferencing": operationPayload["allowVideoConferencing"], - "restrictionsAllowVoiceDialing": operationPayload["allowVoiceDialing"], - "restrictionsAllowYouTube": operationPayload["allowYouTube"], - "restrictionsAllowITunes": operationPayload["allowiTunes"], - "restrictionsForceAssistantProfanityFilter": operationPayload["forceAssistantProfanityFilter"], - "restrictionsForceEncryptedBackup": operationPayload["forceEncryptedBackup"], - "restrictionsForceITunesStorePasswordEntry": operationPayload["forceITunesStorePasswordEntry"], - "restrictionsForceLimitAdTracking": operationPayload["forceLimitAdTracking"], - "restrictionsForceAirPlayOutgoingRequestsPairingPassword": operationPayload["forceAirPlayOutgoingRequestsPairingPassword"], - "restrictionsForceAirPlayIncomingRequestsPairingPassword": operationPayload["forceAirPlayIncomingRequestsPairingPassword"], - "restrictionsAllowManagedAppsCloudSync": operationPayload["allowManagedAppsCloudSync"], - "restrictionsAllowEraseContentAndSettings": operationPayload["allowEraseContentAndSettings"], - "restrictionsAllowSpotlightInternetResults": operationPayload["allowSpotlightInternetResults"], - "restrictionsAllowEnablingRestrictions": operationPayload["allowEnablingRestrictions"], - "restrictionsAllowActivityContinuation": operationPayload["allowActivityContinuation"], - "restrictionsAllowEnterpriseBookBackup": operationPayload["allowEnterpriseBookBackup"], - "restrictionsAllowEnterpriseBookMetadataSync": operationPayload["allowEnterpriseBookMetadataSync"], - "restrictionsAllowPodcasts": operationPayload["allowPodcasts"], - "restrictionsAllowDefinitionLookup": operationPayload["allowDefinitionLookup"], - "restrictionsAllowPredictiveKeyboard": operationPayload["allowPredictiveKeyboard"], - "restrictionsAllowAutoCorrection": operationPayload["allowAutoCorrection"], - "restrictionsAllowSpellCheck": operationPayload["allowSpellCheck"], - "restrictionsSafariAcceptCookies": operationPayload["safariAcceptCookies"], - "restrictionsAutonomousSingleAppModePermittedAppIDs": operationPayload["autonomousSingleAppModePermittedAppIDs"] - }; - break; - case iosOperationConstants["VPN_OPERATION_CODE"]: - var pptp = false; - var l2tp = false; - if (operationPayload["vpnType"] == "PPTP") { - pptp = true; - } else if (operationPayload["vpnType"] == "L2TP") { - l2tp = true; - } - - payload = { - "userDefinedName": operationPayload["userDefinedName"], - "overridePrimary": operationPayload["overridePrimary"], - "onDemandEnabled": operationPayload["onDemandEnabled"], - "onDemandMatchDomainsAlways": operationPayload["onDemandMatchDomainsAlways"], - "onDemandMatchDomainsNever": operationPayload["onDemandMatchDomainsNever"], - "onDemandMatchDomainsOnRetry": operationPayload["onDemandMatchDomainsOnRetry"], - "onDemandRules": operationPayload["onDemandRules"], - "vendorConfigs": operationPayload["vendorConfigs"], - "vpnType": operationPayload["vpnType"], - "pptpAuthName": pptp ? operationPayload.ppp["authName"] : "", - "pptpTokenCard": pptp ? operationPayload.ppp["tokenCard"] : "", - "pptpAuthPassword": pptp ? operationPayload.ppp["authPassword"] : "", - "pptpCommRemoteAddress": pptp ? operationPayload.ppp["commRemoteAddress"] : "", - "pptpRSASecureID": pptp ? operationPayload.ppp["RSASecureID"] : "", - "pptpCCPEnabled": pptp ? operationPayload.ppp["CCPEnabled"] : "", - "pptpCCPMPPE40Enabled": pptp ? operationPayload.ppp["CCPMPPE40Enabled"] : "", - "pptpCCPMPPE128Enabled": pptp ? operationPayload.ppp["CCPMPPE128Enabled"] : "", - "l2tpAuthName": l2tp ? operationPayload.ppp["authName"] : "", - "l2tpTokenCard": l2tp ? operationPayload.ppp["tokenCard"] : "", - "l2tpAuthPassword": l2tp ? operationPayload.ppp["authPassword"] : "", - "l2tpCommRemoteAddress": l2tp ? operationPayload.ppp["commRemoteAddress"] : "", - "l2tpRSASecureID": l2tp ? operationPayload.ppp["RSASecureID"] : "", - "ipsecRemoteAddress": operationPayload.ipSec["remoteAddress"], - "ipsecAuthenticationMethod": operationPayload.ipSec["authenticationMethod"], - "ipsecLocalIdentifier": operationPayload.ipSec["localIdentifier"], - "ipsecSharedSecret": operationPayload.ipSec["sharedSecret"], - "ipsecPayloadCertificateUUID": operationPayload.ipSec["payloadCertificateUUID"], - "ipsecXAuthEnabled": operationPayload.ipSec["XAuthEnabled"], - "ipsecXAuthName": operationPayload.ipSec["XAuthName"], - "ipsecPromptForVPNPIN": operationPayload.ipSec["promptForVPNPIN"], - "ikev2RemoteAddress": operationPayload.ikEv2["remoteAddress"], - "ikev2LocalIdentifier": operationPayload.ikEv2["localIdentifier"], - "ikev2RemoteIdentifier": operationPayload.ikEv2["remoteIdentifier"], - "ikev2AuthenticationMethod": operationPayload.ikEv2["authenticationMethod"], - "ikev2SharedSecret": operationPayload.ikEv2["sharedSecret"], - "ikev2PayloadCertificateUUID": operationPayload.ikEv2["payloadCertificateUUID"], - "ikev2ExtendedAuthEnabled": operationPayload.ikEv2["extendedAuthEnabled"], - "ikev2AuthName": operationPayload.ikEv2["authName"], - "ikev2AuthPassword": operationPayload.ikEv2["authPassword"], - "ikev2DeadPeerDetectionInterval": operationPayload.ikEv2["deadPeerDetectionInterval"], - "ikev2ServerCertificateIssuerCommonName": operationPayload.ikEv2["serverCertificateIssuerCommonName"], - "ikev2ServerCertificateCommonName": operationPayload.ikEv2["serverCertificateCommonName"] - }; - break; - case iosOperationConstants["PER_APP_VPN_OPERATION_CODE"]: - payload = { - "operation": { - "VPNUUID": operationPayload["PER-APP-VPNUUID"], - "safariDomains": operationPayload["safariDomains"], - "onDemandMatchAppEnabled": operationPayload["onDemandMatchAppEnabled"] - } - }; - break; - case iosOperationConstants["APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE"]: - payload = { - "operation": { - "appLayerVPNMappings": operationPayload["appLayerVPNMappings"] - } - }; - break; - case iosOperationConstants["WIFI_OPERATION_CODE"]: - payload = { - "wifiHiddenNetwork": operationPayload["hiddenNetwork"], - "wifiSSID": operationPayload["SSID"], - "wifiAutoJoin": operationPayload["autoJoin"], - "wifiProxyType": operationPayload["proxyType"], - "wifiEncryptionType": operationPayload["encryptionType"], - "wifiIsHotSpot": operationPayload["hotspot"], - "wifiDomainName": operationPayload["domainName"], - "wifiServiceProviderRoamingEnabled": operationPayload["serviceProviderRoamingEnabled"], - "wifiDisplayedOperatorName": operationPayload["displayedOperatorName"], - "wifiRoamingConsortiumOIs": operationPayload["roamingConsortiumOIs"], - "wifiPassword": operationPayload["password"], - "wifiPayloadCertUUID": operationPayload["payloadCertificateUUID"], - "wifiProxyServer": operationPayload["proxyServer"], - "wifiProxyPort": operationPayload["proxyPort"], - "wifiProxyUsername": operationPayload["proxyUsername"], - "wifiProxyPassword": operationPayload["proxyPassword"], - "wifiProxyPACURL": operationPayload["proxyPACURL"], - "wifiProxyPACFallbackAllowed": operationPayload["proxyPACFallbackAllowed"], - "wifiNAIRealmNames": operationPayload["nairealmNames"], - "wifiMCCAndMNCs": operationPayload["mccandMNCs"], - "wifiEAPUsername": operationPayload.clientConfiguration["username"], - "wifiAcceptedEAPTypes": operationPayload.clientConfiguration["acceptEAPTypes"], - "wifiEAPPassword": operationPayload.clientConfiguration["userPassword"], - "wifiEAPOneTimePassword": operationPayload.clientConfiguration["oneTimePassword"], - "wifiPayloadCertificateAnchorUUIDs": operationPayload.clientConfiguration["payloadCertificateAnchorUUID"], - "wifiEAPOuterIdentity": operationPayload.clientConfiguration["outerIdentity"], - "wifiTLSTrustedServerNames": operationPayload.clientConfiguration["tlstrustedServerNames"], - "wifiEAPTLSAllowTrustExceptions": operationPayload.clientConfiguration["tlsallowTrustExceptions"], - "wifiEAPTLSCertIsRequired": operationPayload.clientConfiguration["tlscertificateIsRequired"], - "wifiEAPTLSInnerAuthType": operationPayload.clientConfiguration["ttlsinnerAuthentication"], - "wifiEAPFastUsePAC": operationPayload.clientConfiguration["eapfastusePAC"], - "wifiEAPFastProvisionPAC": operationPayload.clientConfiguration["eapfastprovisionPAC"], - "wifiEAPFastProvisionPACAnonymously": operationPayload.clientConfiguration["eapfastprovisionPACAnonymously"], - "wifiEAPSIMNoOfRands": operationPayload.clientConfiguration["eapsimnumberOfRANDs"] - }; - break; - case iosOperationConstants["EMAIL_OPERATION_CODE"]: - payload = { - "emailAccountDescription": operationPayload["emailAccountDescription"], - "emailAccountName": operationPayload["emailAccountName"], - "emailAccountType": operationPayload["emailAccountType"], - "emailAddress": operationPayload["emailAddress"], - "emailIncomingMailServerAuthentication": operationPayload["incomingMailServerAuthentication"], - "emailIncomingMailServerHostname": operationPayload["incomingMailServerHostName"], - "emailIncomingMailServerPort": operationPayload["incomingMailServerPortNumber"], - "emailIncomingUseSSL": operationPayload["incomingMailServerUseSSL"], - "emailIncomingMailServerUsername": operationPayload["incomingMailServerUsername"], - "emailIncomingMailServerPassword": operationPayload["incomingPassword"], - "emailOutgoingMailServerPassword": operationPayload["outgoingPassword"], - "emailOutgoingPasswordSameAsIncomingPassword": operationPayload["outgoingPasswordSameAsIncomingPassword"], - "emailOutgoingMailServerAuthentication": operationPayload["outgoingMailServerAuthentication"], - "emailOutgoingMailServerHostname": operationPayload["outgoingMailServerHostName"], - "emailOutgoingMailServerPort": operationPayload["outgoingMailServerPortNumber"], - "emailOutgoingUseSSL": operationPayload["outgoingMailServerUseSSL"], - "emailOutgoingMailServerUsername": operationPayload["outgoingMailServerUsername"], - "emailPreventMove": operationPayload["preventMove"], - "emailPreventAppSheet": operationPayload["preventAppSheet"], - "emailDisableMailRecentsSyncing": operationPayload["disableMailRecentsSyncing"], - "emailIncomingMailServerIMAPPathPrefix": operationPayload["incomingMailServerIMAPPathPrefix"], - "emailSMIMEEnabled": operationPayload["smimeenabled"], - "emailSMIMESigningCertificateUUID": operationPayload["smimesigningCertificateUUID"], - "emailSMIMEEncryptionCertificateUUID": operationPayload["smimeencryptionCertificateUUID"], - "emailSMIMEEnablePerMessageSwitch": operationPayload["smimeenablePerMessageSwitch"] - }; - break; - case iosOperationConstants["AIRPLAY_OPERATION_CODE"]: - payload = { - "airplayDestinations": operationPayload["airPlayDestinations"], - "airplayCredentials": operationPayload["airPlayCredentials"] - }; - break; - case iosOperationConstants["LDAP_OPERATION_CODE"]: - payload = { - "ldapAccountDescription": operationPayload["accountDescription"], - "ldapAccountHostname": operationPayload["accountHostName"], - "ldapUseSSL": operationPayload["accountUseSSL"], - "ldapAccountUsername": operationPayload["accountUsername"], - "ldapAccountPassword": operationPayload["accountPassword"], - "ldapSearchSettings": operationPayload["ldapSearchSettings"] - }; - break; - case iosOperationConstants["CALENDAR_OPERATION_CODE"]: - payload = { - "calendarAccountDescription": operationPayload["accountDescription"], - "calendarAccountHostname": operationPayload["hostName"], - "calendarAccountUsername": operationPayload["username"], - "calendarAccountPassword": operationPayload["password"], - "calendarUseSSL": operationPayload["useSSL"], - "calendarAccountPort": operationPayload["port"], - "calendarPrincipalURL": operationPayload["principalURL"] - }; - break; - case iosOperationConstants["CALENDAR_SUBSCRIPTION_OPERATION_CODE"]: - payload = { - "calendarSubscriptionDescription": operationPayload["accountDescription"], - "calendarSubscriptionHostname": operationPayload["hostName"], - "calendarSubscriptionUsername": operationPayload["username"], - "calendarSubscriptionPassword": operationPayload["password"], - "calendarSubscriptionUseSSL": operationPayload["useSSL"] - }; - break; - case iosOperationConstants["APN_OPERATION_CODE"]: - payload = { - "apnConfigurations": operationPayload["apnConfigurations"] - }; - break; - case iosOperationConstants["CELLULAR_OPERATION_CODE"]: - payload = { - "cellularAttachAPNName": operationPayload["attachAPNName"], - "cellularAuthenticationType": operationPayload["authenticationType"], - "cellularUsername": operationPayload["username"], - "cellularPassword": operationPayload["password"], - "cellularAPNConfigurations": operationPayload["apnConfigurations"] - }; - break; - } - return payload; - }; - - privateMethods.generateIOSOperationPayload = function (operationCode, operationData, deviceList) { - var payload; - var operationType; - switch (operationCode) { - case iosOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "forcePIN": operationData["passcodePolicyForcePIN"], - "allowSimple": operationData["passcodePolicyAllowSimple"], - "requireAlphanumeric": operationData["passcodePolicyRequireAlphanumeric"], - "minLength": operationData["passcodePolicyMinLength"], - "minComplexChars": operationData["passcodePolicyMinComplexChars"], - "maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"], - "pinHistory": operationData["passcodePolicyPasscodeHistory"], - "maxInactivity": operationData["passcodePolicyMaxAutoLock"], - "maxGracePeriod": operationData["passcodePolicyGracePeriod"], - "maxFailedAttempts": operationData["passcodePolicyMaxFailedAttempts"] - } - }; - break; - case iosOperationConstants["WIFI_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - if (operationData["wifiProxyPort"] == "") { - operationData["wifiProxyPort"] = -1; - } - payload = { - "operation": { - "SSID": operationData["wifiSSID"], - "hiddenNetwork": operationData["wifiHiddenNetwork"], - "autoJoin": operationData["wifiAutoJoin"], - "proxyType": operationData["wifiProxyType"], - "encryptionType": operationData["wifiEncryptionType"], - "hotspot": operationData["wifiIsHotSpot"], - "domainName": operationData["wifiDomainName"], - "serviceProviderRoamingEnabled": operationData["wifiServiceProviderRoamingEnabled"], - "displayedOperatorName": operationData["wifiDisplayedOperatorName"], - "roamingConsortiumOIs": operationData["wifiRoamingConsortiumOIs"], - "password": operationData["wifiPassword"], - "clientConfiguration": { - "username": operationData["wifiEAPUsername"], - "acceptEAPTypes": operationData["wifiAcceptedEAPTypes"], - "userPassword": operationData["wifiEAPPassword"], - "oneTimePassword": operationData["wifiEAPOneTimePassword"], - "payloadCertificateAnchorUUID": operationData["wifiPayloadCertificateAnchorUUIDs"], - "outerIdentity": operationData["wifiEAPOuterIdentity"], - "tlstrustedServerNames": operationData["wifiTLSTrustedServerNames"], - "tlsallowTrustExceptions": operationData["wifiEAPTLSAllowTrustExceptions"], - "tlscertificateIsRequired": operationData["wifiEAPTLSCertIsRequired"], - "ttlsinnerAuthentication": operationData["wifiEAPTLSInnerAuthType"], - "eapfastusePAC": operationData["wifiEAPFastUsePAC"], - "eapfastprovisionPAC": operationData["wifiEAPFastProvisionPAC"], - "eapfastprovisionPACAnonymously": operationData["wifiEAPFastProvisionPACAnonymously"], - "eapsimnumberOfRANDs": operationData["wifiEAPSIMNoOfRands"] - }, - "payloadCertificateUUID": operationData["wifiPayloadCertUUID"], - "proxyServer": operationData["wifiProxyServer"], - "proxyPort": operationData["wifiProxyPort"], - "proxyUsername": operationData["wifiProxyUsername"], - "proxyPassword": operationData["wifiProxyPassword"], - "proxyPACURL": operationData["wifiProxyPACURL"], - "proxyPACFallbackAllowed": operationData["wifiProxyPACFallbackAllowed"], - "nairealmNames": operationData["wifiNAIRealmNames"], - "mccandMNCs": operationData["wifiMCCAndMNCs"] - } - }; - break; - case iosOperationConstants["VPN_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - var ppp = {}; - var ipSec = {}; - var ikev2 = {}; - var pulseSecure = {}; - - if (operationData["vpnType"] == "PPTP") { - ppp = { - "authName": operationData["pptpAuthName"], - "tokenCard": operationData["pptpTokenCard"], - "authPassword": operationData["pptpAuthPassword"], - "commRemoteAddress": operationData["pptpCommRemoteAddress"], - "RSASecureID": operationData["pptpRSASecureID"], - "CCPEnabled": operationData["pptpCCPEnabled"], - "CCPMPPE40Enabled": operationData["pptpCCPMPPE40Enabled"], - "CCPMPPE128Enabled": operationData["pptpCCPMPPE128Enabled"] - }; - } else if (operationData["vpnType"] == "L2TP") { - ppp = { - "authName": operationData["l2tpAuthName"], - "tokenCard": operationData["l2tpTokenCard"], - "authPassword": operationData["l2tpAuthPassword"], - "commRemoteAddress": operationData["l2tpCommRemoteAddress"], - "RSASecureID": operationData["l2tpRSASecureID"] - }; - } else if (operationData["vpnType"] == "IPSec") { - ipSec = { - "remoteAddress": operationData["ipsecRemoteAddress"], - "authenticationMethod": operationData["ipsecAuthenticationMethod"], - "localIdentifier": operationData["ipsecLocalIdentifier"], - "sharedSecret": operationData["ipsecSharedSecret"], - "payloadCertificateUUID": operationData["ipsecPayloadCertificateUUID"], - "XAuthEnabled": operationData["ipsecXAuthEnabled"], - "XAuthName": operationData["ipsecXAuthName"], - "promptForVPNPIN": operationData["ipsecPromptForVPNPIN"] - }; - } else if (operationData["vpnType"] == "IKEv2") { - ikev2 = { - "remoteAddress": operationData["ikev2RemoteAddress"], - "localIdentifier": operationData["ikev2LocalIdentifier"], - "remoteIdentifier": operationData["ikev2RemoteIdentifier"], - "authenticationMethod": operationData["ikev2AuthenticationMethod"], - "sharedSecret": operationData["ikev2SharedSecret"], - "payloadCertificateUUID": operationData["ikev2PayloadCertificateUUID"], - "extendedAuthEnabled": operationData["ikev2ExtendedAuthEnabled"], - "authName": operationData["ikev2AuthName"], - "authPassword": operationData["ikev2AuthPassword"], - "deadPeerDetectionInterval": operationData["ikev2DeadPeerDetectionInterval"], - "serverCertificateIssuerCommonName": operationData["ikev2ServerCertificateIssuerCommonName"], - "serverCertificateCommonName": operationData["ikev2ServerCertificateCommonName"] - }; - } else if (operationData["vpnType"] == "PulseSecure") { - pulseSecure = { - "remoteAddress": operationData["pulsesecureRemoteAddress"], - "userName": operationData["pulsesecureName"], - "sharedSecret": operationData["pulsesecureSharedSecret"] - }; - } - - var domainsAlways = new Array(); - for (var i = 0; i < operationData["onDemandMatchDomainsAlways"].length; i++) { - domainsAlways.push(operationData["onDemandMatchDomainsAlways"][i].domain); - } - - var domainsNever = new Array(); - for (var i = 0; i < operationData["onDemandMatchDomainsNever"].length; i++) { - domainsNever.push(operationData["onDemandMatchDomainsNever"][i].domain); - } - - var domainsRetry = new Array(); - for (var i = 0; i < operationData["onDemandMatchDomainsOnRetry"].length; i++) { - domainsRetry.push(operationData["onDemandMatchDomainsOnRetry"][i].domain); - } - - payload = { - "operation": { - "userDefinedName": operationData["userDefinedName"], - "overridePrimary": operationData["overridePrimary"], - "onDemandEnabled": operationData["onDemandEnabled"], - "onDemandMatchDomainsAlways": domainsAlways, - "onDemandMatchDomainsNever": domainsNever, - "onDemandMatchDomainsOnRetry": domainsRetry, - "onDemandRules": operationData["onDemandRules"], - "vendorConfigs": operationData["vendorConfigs"], - "vpnType": operationData["vpnType"], - "ppp": ppp, - "ipSec": ipSec, - "ikEv2": ikev2, - "pulseSecure": pulseSecure - } - }; - break; - case iosOperationConstants["PER_APP_VPN_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - var domains = new Array(); - for (var i = 0; i < operationData["safariDomains"].length; i++) { - domains.push(operationData["safariDomains"][i].domain); - } - payload = { - "operation": { - "VPNUUID": operationData["VPNUUID"], - "safariDomains": domains, - "onDemandMatchAppEnabled": operationData["onDemandMatchAppEnabled"] - } - }; - break; - case iosOperationConstants["APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "appLayerVPNMappings": operationData["appLayerVPNMappings"] - } - }; - break; - case iosOperationConstants["RESTRICTIONS_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "allowAccountModification": operationData["restrictionsAllowAccountModification"], - "allowAddingGameCenterFriends": operationData["restrictionsAllowAddingGameCenterFriends"], - "allowAirDrop": operationData["restrictionsAllowAirDrop"], - "allowAppCellularDataModification": operationData["restrictionsAllowAppCellularDataModification"], - "allowAppInstallation": operationData["restrictionsAllowAppInstallation"], - "allowAppRemoval": operationData["restrictionsAllowAppRemoval"], - "allowAssistant": operationData["restrictionsAllowAssistant"], - "allowAssistantUserGeneratedContent": operationData["restrictionsAllowAssistantUserGeneratedContent"], - "allowAssistantWhileLocked": operationData["restrictionsAllowAssistantWhileLocked"], - "allowBookstore": operationData["restrictionsAllowBookstore"], - "allowBookstoreErotica": operationData["restrictionsAllowBookstoreErotica"], - "allowCamera": operationData["restrictionsAllowCamera"], - "allowChat": operationData["restrictionsAllowChat"], - "allowCloudBackup": operationData["restrictionsAllowCloudBackup"], - "allowCloudDocumentSync": operationData["restrictionsAllowCloudDocumentSync"], - "allowCloudKeychainSync": operationData["restrictionsAllowCloudKeychainSync"], - "allowDiagnosticSubmission": operationData["restrictionsAllowDiagnosticSubmission"], - "allowExplicitContent": operationData["restrictionsAllowExplicitContent"], - "allowFindMyFriendsModification": operationData["restrictionsAllowFindMyFriendsModification"], - "allowFingerprintForUnlock": operationData["restrictionsAllowFingerprintForUnlock"], - "allowGameCenter": operationData["restrictionsAllowGameCenter"], - "allowGlobalBackgroundFetchWhenRoaming": operationData["restrictionsAllowGlobalBackgroundFetchWhenRoaming"], - "allowInAppPurchases": operationData["restrictionsAllowInAppPurchases"], - "allowLockScreenControlCenter": operationData["restrictionsAllowLockScreenControlCenter"], - "allowHostPairing": operationData["restrictionsAllowHostPairing"], - "allowLockScreenNotificationsView": operationData["restrictionsAllowLockScreenNotificationsView"], - "allowLockScreenTodayView": operationData["restrictionsAllowLockScreenTodayView"], - "allowMultiplayerGaming": operationData["restrictionsAllowMultiplayerGaming"], - "allowOpenFromManagedToUnmanaged": operationData["restrictionsAllowOpenFromManagedToUnmanaged"], - "allowOpenFromUnmanagedToManaged": operationData["restrictionsAllowOpenFromUnmanagedToManaged"], - "allowOTAPKIUpdates": operationData["restrictionsAllowOTAPKIUpdates"], - "allowPassbookWhileLocked": operationData["restrictionsAllowPassbookWhileLocked"], - "allowPhotoStream": operationData["restrictionsAllowPhotoStream"], - "allowSafari": operationData["restrictionsAllowSafari"], - "safariAllowAutoFill": operationData["restrictionsSafariAllowAutoFill"], - "safariForceFraudWarning": operationData["restrictionsSafariForceFraudWarning"], - "safariAllowJavaScript": operationData["restrictionsSafariAllowJavaScript"], - "safariAllowPopups": operationData["restrictionsSafariAllowPopups"], - "allowScreenShot": operationData["restrictionsAllowScreenShot"], - "allowSharedStream": operationData["restrictionsAllowSharedStream"], - "allowUIConfigurationProfileInstallation": operationData["restrictionsAllowUIConfigurationProfileInstallation"], - "allowUntrustedTLSPrompt": operationData["restrictionsAllowUntrustedTLSPrompt"], - "allowVideoConferencing": operationData["restrictionsAllowVideoConferencing"], - "allowVoiceDialing": operationData["restrictionsAllowVoiceDialing"], - "allowYouTube": operationData["restrictionsAllowYouTube"], - "allowiTunes": operationData["restrictionsAllowITunes"], - "forceAssistantProfanityFilter": operationData["restrictionsForceAssistantProfanityFilter"], - "forceEncryptedBackup": operationData["restrictionsForceEncryptedBackup"], - "forceITunesStorePasswordEntry": operationData["restrictionsForceITunesStorePasswordEntry"], - "forceLimitAdTracking": operationData["restrictionsForceLimitAdTracking"], - "forceAirPlayOutgoingRequestsPairingPassword": operationData["restrictionsForceAirPlayOutgoingRequestsPairingPassword"], - "forceAirPlayIncomingRequestsPairingPassword": operationData["restrictionsForceAirPlayIncomingRequestsPairingPassword"], - "allowManagedAppsCloudSync": operationData["restrictionsAllowManagedAppsCloudSync"], - "allowEraseContentAndSettings": operationData["restrictionsAllowEraseContentAndSettings"], - "allowSpotlightInternetResults": operationData["restrictionsAllowSpotlightInternetResults"], - "allowEnablingRestrictions": operationData["restrictionsAllowEnablingRestrictions"], - "allowActivityContinuation": operationData["restrictionsAllowActivityContinuation"], - "allowEnterpriseBookBackup": operationData["restrictionsAllowEnterpriseBookBackup"], - "allowEnterpriseBookMetadataSync": operationData["restrictionsAllowEnterpriseBookMetadataSync"], - "allowPodcasts": operationData["restrictionsAllowPodcasts"], - "allowDefinitionLookup": operationData["restrictionsAllowDefinitionLookup"], - "allowPredictiveKeyboard": operationData["restrictionsAllowPredictiveKeyboard"], - "allowAutoCorrection": operationData["restrictionsAllowAutoCorrection"], - "allowSpellCheck": operationData["restrictionsAllowSpellCheck"], - "safariAcceptCookies": operationData["restrictionsSafariAcceptCookies"], - "autonomousSingleAppModePermittedAppIDs": operationData["restrictionsAutonomousSingleAppModePermittedAppIDs"] - } - }; - break; - case iosOperationConstants["EMAIL_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "emailAccountDescription": operationData["emailAccountDescription"], - "emailAccountName": operationData["emailAccountName"], - "emailAccountType": operationData["emailAccountType"], - "emailAddress": operationData["emailAddress"], - "incomingMailServerAuthentication": operationData["emailIncomingMailServerAuthentication"], - "incomingMailServerHostName": operationData["emailIncomingMailServerHostname"], - "incomingMailServerPortNumber": operationData["emailIncomingMailServerPort"], - "incomingMailServerUseSSL": operationData["emailIncomingUseSSL"], - "incomingMailServerUsername": operationData["emailIncomingMailServerUsername"], - "incomingPassword": operationData["emailIncomingMailServerPassword"], - "outgoingPassword": operationData["emailOutgoingMailServerPassword"], - "outgoingPasswordSameAsIncomingPassword": operationData["emailOutgoingPasswordSameAsIncomingPassword"], - "outgoingMailServerAuthentication": operationData["emailOutgoingMailServerAuthentication"], - "outgoingMailServerHostName": operationData["emailOutgoingMailServerHostname"], - "outgoingMailServerPortNumber": operationData["emailOutgoingMailServerPort"], - "outgoingMailServerUseSSL": operationData["emailOutgoingUseSSL"], - "outgoingMailServerUsername": operationData["emailOutgoingMailServerUsername"], - "preventMove": operationData["emailPreventMove"], - "preventAppSheet": operationData["emailPreventAppSheet"], - "disableMailRecentsSyncing": operationData["emailDisableMailRecentsSyncing"], - "incomingMailServerIMAPPathPrefix": operationData["emailIncomingMailServerIMAPPathPrefix"], - "smimeenabled": operationData["emailSMIMEEnabled"], - "smimesigningCertificateUUID": operationData["emailSMIMESigningCertificateUUID"], - "smimeencryptionCertificateUUID": operationData["emailSMIMEEncryptionCertificateUUID"], - "smimeenablePerMessageSwitch": operationData["emailSMIMEEnablePerMessageSwitch"] - } - }; - break; - case iosOperationConstants["AIRPLAY_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "airPlayDestinations": operationData["airplayDestinations"], - "airPlayCredentials": operationData["airplayCredentials"] - } - }; - break; - case iosOperationConstants["LDAP_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "accountDescription": operationData["ldapAccountDescription"], - "accountHostName": operationData["ldapAccountHostname"], - "accountUseSSL": operationData["ldapUseSSL"], - "accountUsername": operationData["ldapAccountUsername"], - "accountPassword": operationData["ldapAccountPassword"], - "ldapSearchSettings": operationData["ldapSearchSettings"] - } - }; - break; - case iosOperationConstants["CALENDAR_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "accountDescription": operationData["calendarAccountDescription"], - "hostName": operationData["calendarAccountHostname"], - "username": operationData["calendarAccountUsername"], - "password": operationData["calendarAccountPassword"], - "useSSL": operationData["calendarUseSSL"], - "port": operationData["calendarAccountPort"], - "principalURL": operationData["calendarPrincipalURL"] - } - }; - break; - case iosOperationConstants["CALENDAR_SUBSCRIPTION_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "accountDescription": operationData["calendarSubscriptionDescription"], - "hostName": operationData["calendarSubscriptionHostname"], - "username": operationData["calendarSubscriptionUsername"], - "password": operationData["calendarSubscriptionPassword"], - "useSSL": operationData["calendarSubscriptionUseSSL"] - } - }; - break; - case iosOperationConstants["APN_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "apnConfigurations": operationData["apnConfigurations"] - } - }; - break; - case iosOperationConstants["DOMAIN_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "emailDomains": operationData["emailDomains"], - "webDomains": operationData["webDomains"] - } - }; - break; - case - iosOperationConstants["CELLULAR_OPERATION_CODE"] - : - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "attachAPNName": operationData["cellularAttachAPNName"], - "authenticationType": operationData["cellularAuthenticationType"], - "username": operationData["cellularUsername"], - "password": operationData["cellularPassword"], - "apnConfigurations": operationData["cellularAPNConfigurations"] - } - }; - break; - case - iosOperationConstants["NOTIFICATION_OPERATION_CODE"] - : - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "messageTitle": operationData["messageTitle"], - "messageText": operationData["messageText"] - } - }; - break; - default: - // If the operation is neither of above, it is a command operation - operationType = operationTypeConstants["COMMAND"]; - // Operation payload of a command operation is simply an array of device IDs - payload = deviceList; - } - - if (operationType == operationTypeConstants["PROFILE"] && deviceList) { - payload["deviceIDs"] = deviceList; - } - return payload; - } - ; - /** * Convert the android platform specific code to the generic payload. - * TODO: think of the possibility to follow a pattern to the key name (namespace?) * @param operationCode * @param operationPayload * @returns {{}} @@ -1124,118 +394,6 @@ var operationModule = function () { return "/api/device-mgt/android/v1.0/admin/devices/" + featureMap[operationCode]; }; - /** - * Convert the windows platform specific code to the generic payload. - * TODO: think of the possibility to follow a pattern to the key name (namespace?) - * @param operationCode - * @param operationPayload - * @returns {{}} - */ - privateMethods.generateGenericPayloadFromWindowsPayload = function (operationCode, operationPayload) { - var payload = {}; - operationPayload = JSON.parse(operationPayload); - switch (operationCode) { - case windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - payload = { - "passcodePolicyAllowSimple": operationPayload["allowSimple"], - "passcodePolicyRequireAlphanumeric": operationPayload["requireAlphanumeric"], - "passcodePolicyMinLength": operationPayload["minLength"], - "passcodePolicyMinComplexChars": operationPayload["minComplexChars"], - "passcodePolicyMaxPasscodeAgeInDays": operationPayload["maxPINAgeInDays"], - "passcodePolicyPasscodeHistory": operationPayload["pinHistory"], - "passcodePolicyMaxFailedAttempts": operationPayload["maxFailedAttempts"] - }; - break; - case windowsOperationConstants["CAMERA_OPERATION_CODE"]: - payload = { - "cameraEnabled": operationPayload["enabled"] - }; - break; - case windowsOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"]: - payload = { - "encryptStorageEnabled": operationPayload["encrypted"] - }; - break; - } - return payload; - }; - - privateMethods.generateWindowsOperationPayload = function (operationCode, operationData, deviceList) { - var payload; - var operationType; - switch (operationCode) { - case windowsOperationConstants["CAMERA_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "enabled": operationData["cameraEnabled"] - } - }; - break; - case windowsOperationConstants["CHANGE_LOCK_CODE_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "lockCode": operationData["lockCode"] - } - }; - break; - case windowsOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "encrypted": operationData["encryptStorageEnabled"] - } - }; - break; - case windowsOperationConstants["NOTIFICATION_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "message": operationData["message"] - } - }; - break; - case windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "allowSimple": operationData["passcodePolicyAllowSimple"], - "requireAlphanumeric": operationData["passcodePolicyRequireAlphanumeric"], - "minLength": operationData["passcodePolicyMinLength"], - "minComplexChars": operationData["passcodePolicyMinComplexChars"], - "maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"], - "pinHistory": operationData["passcodePolicyPasscodeHistory"], - "maxFailedAttempts": operationData["passcodePolicyMaxFailedAttempts"] - } - }; - break; - default: - // If the operation is neither of above, it is a command operation - operationType = operationTypeConstants["COMMAND"]; - // Operation payload of a command operation is simply an array of device IDs - payload = deviceList; - } - - if (operationType == operationTypeConstants["PROFILE"] && deviceList) { - payload["deviceIDs"] = deviceList; - } - - return payload; - }; - - - publicMethods.getWindowsServiceEndpoint = function (operationCode) { - var featureMap = { - "DEVICE_LOCK": "lock-devices", - "DISENROLL": "disenroll", - "DEVICE_RING": "ring-device", - "LOCK_RESET": "lock-reset", - "WIPE_DATA": "wipe-data" - }; - //return "/mdm-windows-agent/services/windows/operation/" + featureMap[operationCode]; - return "/api/device-mgt/windows/v1.0/services/windows/admin/devices/" + featureMap[operationCode]; - }; /** * Get the icon for the featureCode * @param operationCode @@ -1259,38 +417,6 @@ var operationModule = function () { return featureMap[operationCode]; }; - /** - * Get the icon for the featureCode - * @param operationCode - * @returns icon class - */ - publicMethods.getWindowsIconForFeature = function (operationCode) { - var featureMap = { - "DEVICE_LOCK": "fw-lock", - "DEVICE_RING": "fw-dial-up", - "DISENROLL": "fw-export", - "LOCK_RESET": "fw-key", - "WIPE_DATA": "fw-delete" - }; - return featureMap[operationCode]; - }; - - /** - * Get the icon for the featureCode - * @param operationCode - * @returns icon class - */ - publicMethods.getIOSIconForFeature = function (operationCode) { - var featureMap = { - "DEVICE_LOCK": "fw-lock", - "LOCATION": "fw-map-location", - "ENTERPRISE_WIPE": "fw-block", - "NOTIFICATION": "fw-message", - "RING": "fw-dial-up" - }; - return featureMap[operationCode]; - }; - /** * Filter a list by a data attribute. * @param prop @@ -1308,12 +434,11 @@ var operationModule = function () { /** * Method to generate Platform specific operation payload. * - * @param platformType Platform Type of the profile * @param operationCode Operation Codes to generate the profile from * @param deviceList Optional device list to include in payload body for operations * @returns {*} */ - publicMethods.generatePayload = function (platformType, operationCode, deviceList) { + publicMethods.generatePayload = function (operationCode, deviceList) { var payload; var operationData = {}; // capturing form input data designated by .operationDataKeys @@ -1430,47 +555,23 @@ var operationModule = function () { } } ); - - switch (platformType) { - case platformTypeConstants["ANDROID"]: - payload = privateMethods.generateAndroidOperationPayload(operationCode, operationData, deviceList); - break; - case platformTypeConstants["IOS"]: - payload = privateMethods.generateIOSOperationPayload(operationCode, operationData, deviceList); - break; - case platformTypeConstants["WINDOWS"]: - payload = privateMethods.generateWindowsOperationPayload(operationCode, operationData, deviceList); - break; - } + payload = privateMethods.generateAndroidOperationPayload(operationCode, operationData, deviceList); return payload; }; /** * Method to populate the Platform specific operation payload. * - * @param platformType Platform Type of the profile * @param operationCode Operation Codes to generate the profile from * @param operationPayload payload * @returns {*} */ - publicMethods.populateUI = function (platformType, operationCode, operationPayload) { - var uiPayload; - switch (platformType) { - case platformTypeConstants["ANDROID"]: - uiPayload = privateMethods.generateGenericPayloadFromAndroidPayload(operationCode, operationPayload); - break; - case platformTypeConstants["IOS"]: - uiPayload = privateMethods.generateGenericPayloadFromIOSPayload(operationCode, operationPayload); - break; - case platformTypeConstants["WINDOWS"]: - uiPayload = privateMethods.generateGenericPayloadFromWindowsPayload(operationCode, operationPayload); - break; - } + publicMethods.populateUI = function (operationCode, operationPayload) { + var uiPayload = privateMethods.generateGenericPayloadFromAndroidPayload(operationCode, operationPayload); // capturing form input data designated by .operationDataKeys $(".operation-data").filterByData("operation-code", operationCode).find(".operationDataKeys").each( function () { var operationDataObj = $(this); - //TODO :remove //operationDataObj.prop('disabled', true) var key = operationDataObj.data("key"); // retrieve corresponding input value associated with the key @@ -1612,18 +713,16 @@ var operationModule = function () { /** * generateProfile method is only used for policy-creation UIs. * - * @param platformType Platform Type of the profile * @param operationCodes Operation codes to generate the profile from - * @returns {{}} + * @returns {object} generated profile */ - publicMethods.generateProfile = function (platformType, operationCodes) { + publicMethods.generateProfile = function (operationCodes) { var generatedProfile = {}; for (var i = 0; i < operationCodes.length; ++i) { var operationCode = operationCodes[i]; - var payload = publicMethods.generatePayload(platformType, operationCode, null); + var payload = publicMethods.generatePayload(operationCode, null); - if (platformType == platformTypeConstants["ANDROID"] && - operationCodes[i] == androidOperationConstants["CAMERA_OPERATION_CODE"]) { + if (operationCodes[i] == androidOperationConstants["CAMERA_OPERATION_CODE"]) { var operations = payload["operation"]; for (var key in operations) { operationCode = key; @@ -1649,133 +748,130 @@ var operationModule = function () { /** * populateProfile method is used to populate the html ui with saved payload. * - * @param platformType Platform Type of the profile * @param payload List of profileFeatures * @returns [] configuredOperations array */ - publicMethods.populateProfile = function (platformType, payload) { + publicMethods.populateProfile = function (payload) { var i, configuredOperations = []; var restrictions = {}; for (i = 0; i < payload.length; ++i) { var configuredFeature = payload[i]; var featureCode = configuredFeature["featureCode"]; var operationPayload = configuredFeature["content"]; - if (platformType == platformTypeConstants["ANDROID"]) { - var restriction = JSON.parse(operationPayload); - if (featureCode == androidOperationConstants["CAMERA_OPERATION_CODE"]) { - restrictions["cameraEnabled"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_ADJUST_VOLUME"]) { - restrictions["disallowAdjustVolumeEnabled"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_BLUETOOTH"]) { - restrictions["disallowConfigBluetooth"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_CELL_BROADCASTS"]) { - restrictions["disallowConfigCellBroadcasts"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_CREDENTIALS"]) { - restrictions["disallowConfigCredentials"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_MOBILE_NETWORKS"]) { - restrictions["disallowConfigMobileNetworks"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_TETHERING"]) { - restrictions["disallowConfigTethering"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_VPN"]) { - restrictions["disallowConfigVpn"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_WIFI"]) { - restrictions["disallowConfigWifi"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_APPS_CONTROL"]) { - restrictions["disallowAppControl"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CREATE_WINDOWS"]) { - restrictions["disallowCreateWindows"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CROSS_PROFILE_COPY_PASTE"]) { - restrictions["disallowCrossProfileCopyPaste"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_DEBUGGING_FEATURES"]) { - restrictions["disallowDebugging"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_FACTORY_RESET"]) { - restrictions["disallowFactoryReset"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_ADD_USER"]) { - restrictions["disallowAddUser"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_INSTALL_APPS"]) { - restrictions["disallowInstallApps"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_INSTALL_UNKNOWN_SOURCES"]) { - restrictions["disallowInstallUnknownSources"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_MODIFY_ACCOUNTS"]) { - restrictions["disallowModifyAccounts"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_MOUNT_PHYSICAL_MEDIA"]) { - restrictions["disallowMountPhysicalMedia"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_NETWORK_RESET"]) { - restrictions["disallowNetworkReset"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_OUTGOING_BEAM"]) { - restrictions["disallowOutgoingBeam"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_OUTGOING_CALLS"]) { - restrictions["disallowOutgoingCalls"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_REMOVE_USER"]) { - restrictions["disallowRemoveUser"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_SAFE_BOOT"]) { - restrictions["disallowSafeBoot"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_SHARE_LOCATION"]) { - restrictions["disallowLocationSharing"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_SMS"]) { - restrictions["disallowSMS"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_UNINSTALL_APPS"]) { - restrictions["disallowUninstallApps"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_UNMUTE_MICROPHONE"]) { - restrictions["disallowUnmuteMicrophone"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_USB_FILE_TRANSFER"]) { - restrictions["disallowUSBFileTransfer"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["ALLOW_PARENT_PROFILE_APP_LINKING"]) { - restrictions["disallowParentProfileAppLinking"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["ENSURE_VERIFY_APPS"]) { - restrictions["ensureVerifyApps"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["AUTO_TIME"]) { - restrictions["enableAutoTime"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["SET_SCREEN_CAPTURE_DISABLED"]) { - restrictions["disableScreenCapture"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["SET_STATUS_BAR_DISABLED"]) { - restrictions["disableStatusBar"] = restriction["enabled"]; - continue; - } + var restriction = JSON.parse(operationPayload); + if (featureCode == androidOperationConstants["CAMERA_OPERATION_CODE"]) { + restrictions["cameraEnabled"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_ADJUST_VOLUME"]) { + restrictions["disallowAdjustVolumeEnabled"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_BLUETOOTH"]) { + restrictions["disallowConfigBluetooth"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_CELL_BROADCASTS"]) { + restrictions["disallowConfigCellBroadcasts"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_CREDENTIALS"]) { + restrictions["disallowConfigCredentials"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_MOBILE_NETWORKS"]) { + restrictions["disallowConfigMobileNetworks"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_TETHERING"]) { + restrictions["disallowConfigTethering"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_VPN"]) { + restrictions["disallowConfigVpn"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_WIFI"]) { + restrictions["disallowConfigWifi"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_APPS_CONTROL"]) { + restrictions["disallowAppControl"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_CREATE_WINDOWS"]) { + restrictions["disallowCreateWindows"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_CROSS_PROFILE_COPY_PASTE"]) { + restrictions["disallowCrossProfileCopyPaste"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_DEBUGGING_FEATURES"]) { + restrictions["disallowDebugging"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_FACTORY_RESET"]) { + restrictions["disallowFactoryReset"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_ADD_USER"]) { + restrictions["disallowAddUser"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_INSTALL_APPS"]) { + restrictions["disallowInstallApps"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_INSTALL_UNKNOWN_SOURCES"]) { + restrictions["disallowInstallUnknownSources"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_MODIFY_ACCOUNTS"]) { + restrictions["disallowModifyAccounts"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_MOUNT_PHYSICAL_MEDIA"]) { + restrictions["disallowMountPhysicalMedia"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_NETWORK_RESET"]) { + restrictions["disallowNetworkReset"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_OUTGOING_BEAM"]) { + restrictions["disallowOutgoingBeam"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_OUTGOING_CALLS"]) { + restrictions["disallowOutgoingCalls"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_REMOVE_USER"]) { + restrictions["disallowRemoveUser"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_SAFE_BOOT"]) { + restrictions["disallowSafeBoot"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_SHARE_LOCATION"]) { + restrictions["disallowLocationSharing"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_SMS"]) { + restrictions["disallowSMS"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_UNINSTALL_APPS"]) { + restrictions["disallowUninstallApps"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_UNMUTE_MICROPHONE"]) { + restrictions["disallowUnmuteMicrophone"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["DISALLOW_USB_FILE_TRANSFER"]) { + restrictions["disallowUSBFileTransfer"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["ALLOW_PARENT_PROFILE_APP_LINKING"]) { + restrictions["disallowParentProfileAppLinking"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["ENSURE_VERIFY_APPS"]) { + restrictions["ensureVerifyApps"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["AUTO_TIME"]) { + restrictions["enableAutoTime"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["SET_SCREEN_CAPTURE_DISABLED"]) { + restrictions["disableScreenCapture"] = restriction["enabled"]; + continue; + } else if (featureCode == androidOperationConstants["SET_STATUS_BAR_DISABLED"]) { + restrictions["disableStatusBar"] = restriction["enabled"]; + continue; } //push the feature-code to the configuration array configuredOperations.push(featureCode); - publicMethods.populateUI(platformType, featureCode, operationPayload); + publicMethods.populateUI(featureCode, operationPayload); } if (typeof restrictions.cameraEnabled !== 'undefined') { configuredOperations.push(androidOperationConstants["CAMERA_OPERATION_CODE"]); - publicMethods.populateUI(platformType, androidOperationConstants["CAMERA_OPERATION_CODE"], JSON.stringify(restrictions)); + publicMethods.populateUI(androidOperationConstants["CAMERA_OPERATION_CODE"], JSON.stringify(restrictions)); } return configuredOperations; }; return publicMethods; -}(); +}(); \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs index 3e598fb0a..7e3708ed9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/configuration.hbs @@ -34,7 +34,7 @@
    @@ -62,16 +62,6 @@ - -
    - - -

    End User License Agreement ( EULA ) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js index a179701e5..ec2af9639 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js @@ -124,8 +124,6 @@ $(document).ready(function () { $("input#android-config-notifier-frequency").val(config.value / 1000); } else if (config.name == configParams["GCM_API_KEY"]) { $("input#android-config-gcm-api-key").val(config.value); - } else if (config.name == configParams["GCM_SENDER_ID"]) { - $("input#android-config-gcm-sender-id").val(config.value); } else if (config.name == configParams["ANDROID_EULA"]) { $("#android-eula").val(config.value); } @@ -159,7 +157,7 @@ $(document).ready(function () { var notifierType = $("#android-config-notifier").find("option:selected").attr("value"); var notifierFrequency = $("input#android-config-notifier-frequency").val(); var gcmAPIKey = $("input#android-config-gcm-api-key").val(); - var gcmSenderId = $("input#android-config-gcm-sender-id").val(); + var gcmSenderId = "sender_id"; var androidLicense = tinyMCE.activeEditor.getContent(); var errorMsgWrapper = "#android-config-error-msg"; var errorMsg = "#android-config-error-msg span"; @@ -170,10 +168,7 @@ $(document).ready(function () { $(errorMsg).text("Provided notifier frequency is invalid. "); $(errorMsgWrapper).removeClass("hidden"); } else if (notifierType == notifierTypeConstants["GCM"] && !gcmAPIKey) { - $(errorMsg).text("GCM API Key is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (notifierType == notifierTypeConstants["GCM"] && !gcmSenderId) { - $(errorMsg).text("GCM Sender ID is a required field. It cannot be empty."); + $(errorMsg).text("FCM API Key is a required field. It cannot be empty."); $(errorMsgWrapper).removeClass("hidden"); } else { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js index d673b6d6a..78b6e8054 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js @@ -15,6 +15,9 @@ * specific language governing permissions and limitations * under the License. */ + +var configuredOperations = []; + // Constants to define Android Operation Constants var androidOperationConstants = { "PASSCODE_POLICY_OPERATION": "passcode-policy", @@ -60,21 +63,56 @@ var updateGroupedInputVisibility = function (domElement) { * * This method will be invoked from the relevant cdmf unit when the edit page gets loaded. * - * @param configuredOperations selected configurations. + * @param profileFeatureList saved feature list */ -var polulateProfileOperations = function (configuredOperations) { +var polulateProfileOperations = function (profileFeatureList) { + var selectedOperations = androidOperationModule.populateProfile(profileFeatureList); $(".wr-advance-operations li.grouped-input").each(function () { updateGroupedInputVisibility(this); }); - for (var i = 0; i < configuredOperations.length; ++i) { - var configuredOperation = configuredOperations[i]; - $(".operation-data").filterByData("operation-code", configuredOperation) + for (var i = 0; i < selectedOperations.length; ++i) { + var selectedOperation = selectedOperations[i]; + $(".operation-data").filterByData("operation-code", selectedOperation) .find(".panel-title .wr-input-control.switch input[type=checkbox]").each(function () { $(this).click(); }); } }; +/** + * Generates policy profile feature list which will be saved with the profile. + * + * This function will be invoked from the relevant cdmf unit at the time of policy creation. + * + * @returns {Array} profile payloads + */ +var generateProfileFeaturesList = function () { + var profilePayloads = []; + var key; + for (key in policy["profile"]) { + if (policy["profile"].hasOwnProperty(key)) { + profilePayloads.push({ + "featureCode": key, + "deviceType": policy["platform"], + "content": policy["profile"][key] + }); + } + } + + return profilePayloads; +}; + +/** + * Generates policy profile object which will be saved with the profile. + * + * This function will be invoked from the relevant cdmf unit at the time of policy creation. + * + * @returns {object} generated profile. + */ +var generatePolicyProfile = function () { + return androidOperationModule.generateProfile(configuredOperations); +}; + /** * Checks if provided number is valid against a range. * @@ -542,30 +580,6 @@ var validatePolicyProfile = function () { return wizardIsToBeContinued; }; -/** - * Generates policy profile object which will be saved with the profile. - * - * This function will be invoked from the relevant cdmf unit at the time of policy creation. - * - * @returns {Array} profile payloads - */ -var generatePolicyProfile = function () { - var profilePayloads = []; - // traverses key by key in policy["profile"] - var key; - for (key in policy["profile"]) { - if (policy["profile"].hasOwnProperty(key)) { - profilePayloads.push({ - "featureCode": key, - "deviceType": policy["platform"], - "content": policy["profile"][key] - }); - } - } - - return profilePayloads; -}; - // Start of HTML embedded invoke methods var showAdvanceOperation = function (operation, button) { $(button).addClass('selected'); @@ -685,6 +699,22 @@ var slideDownPaneAgainstValueSet = function (selectElement, paneID, valueSet) { ); } }; + +var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneID, valueSet) { + var selectedValueOnChange = selectElement.value; + var slideDownVotes = 0; + for (var i = 0; i < valueSet.length; i++) { + if (selectedValueOnChange == valueSet[i]) { + slideDownVotes++; + } + } + var paneSelector = "#" + paneID; + if (slideDownVotes > 0) { + $(paneSelector).removeClass("hidden"); + } else { + $(paneSelector).addClass("hidden"); + } +}; // End of HTML embedded invoke methods diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/js/android-policy-view.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/js/android-policy-view.js index 7d6fecf7e..ab4560488 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/js/android-policy-view.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/js/android-policy-view.js @@ -16,8 +16,6 @@ * under the License. */ -var configuredOperations = []; - /** * Method to update the visibility (i.e. disabled or enabled view) * of grouped input according to the values @@ -47,9 +45,10 @@ var updateGroupedInputVisibility = function (domElement) { * * This method will be invoked from the relevant cdmf unit when the edit page gets loaded. * - * @param selectedConfigurations selected configurations. + * @param profileFeatureList selected configurations. */ -var polulateProfileOperations = function (selectedConfigurations) { +var polulateProfileOperations = function (profileFeatureList) { + var selectedConfigurations = androidOperationModule.populateProfile(profileFeatureList); $(".wr-advance-operations li.grouped-input").each(function () { updateGroupedInputVisibility(this); }); @@ -169,35 +168,6 @@ var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneI }; // End of HTML embedded invoke methods - -// Start of functions related to grid-input-view - -/** - * Method to set count id to cloned elements. - * @param {object} addFormContainer - */ -var setId = function (addFormContainer) { - $(addFormContainer).find("[data-add-form-clone]").each(function (i) { - $(this).attr("id", $(this).attr("data-add-form-clone").slice(1) + "-" + (i + 1)); - if ($(this).find(".index").length > 0) { - $(this).find(".index").html(i + 1); - } - }); -}; - -/** - * Method to set count id to cloned elements. - * @param {object} addFormContainer - */ -var showHideHelpText = function (addFormContainer) { - var helpText = "[data-help-text=add-form]"; - if ($(addFormContainer).find("[data-add-form-clone]").length > 0) { - $(addFormContainer).find(helpText).hide(); - } else { - $(addFormContainer).find(helpText).show(); - } -}; - /** * This method will display appropriate fields based on wifi type * @param {object} wifi type select object @@ -229,148 +199,19 @@ var changeAndroidWifiPolicyEAP = function (select, superSelect) { }; $(document).ready(function () { - // Maintains an array of configured features of the profile var advanceOperations = ".wr-advance-operations"; $(advanceOperations).on("click", ".wr-input-control.switch", function (event) { - var operationCode = $(this).parents(".operation-data").data("operation-code"); var operation = $(this).parents(".operation-data").data("operation"); - var operationDataWrapper = $(this).data("target"); // prevents event bubbling by figuring out what element it's being called from. if (event.target.tagName == "INPUT") { var featureConfiguredIcon; if ($("input[type='checkbox']", this).is(":checked")) { - configuredOperations.push(operationCode); - // when a feature is enabled, if "zero-configured-features" msg is available, hide that. - var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg"; - if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) { - $(zeroConfiguredOperationsErrorMsg).addClass("hidden"); - } // add configured-state-icon to the feature featureConfiguredIcon = "#" + operation + "-configured"; if ($(featureConfiguredIcon).hasClass("hidden")) { $(featureConfiguredIcon).removeClass("hidden"); } - } else { - //splicing the array if operation is present. - var index = $.inArray(operationCode, configuredOperations); - if (index != -1) { - configuredOperations.splice(index, 1); - } - // when a feature is disabled, clearing all its current configured, error or success states - var subErrorMsgWrapper = "#" + operation + "-feature-error-msg"; - var subErrorIcon = "#" + operation + "-error"; - var subOkIcon = "#" + operation + "-ok"; - featureConfiguredIcon = "#" + operation + "-configured"; - - if (!$(subErrorMsgWrapper).hasClass("hidden")) { - $(subErrorMsgWrapper).addClass("hidden"); - } - if (!$(subErrorIcon).hasClass("hidden")) { - $(subErrorIcon).addClass("hidden"); - } - if (!$(subOkIcon).hasClass("hidden")) { - $(subOkIcon).addClass("hidden"); - } - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - // reinitializing input fields into the defaults - $(operationDataWrapper + " input").each( - function () { - if ($(this).is("input:text")) { - $(this).val($(this).data("default")); - } else if ($(this).is("input:password")) { - $(this).val(""); - } else if ($(this).is("input:checkbox")) { - $(this).prop("checked", $(this).data("default")); - // if this checkbox is the parent input of a grouped-input - if ($(this).hasClass("parent-input")) { - var groupedInput = $(this).parent().parent().parent(); - updateGroupedInputVisibility(groupedInput); - } - } - } - ); - // reinitializing select fields into the defaults - $(operationDataWrapper + " select").each( - function () { - var defaultOption = $(this).data("default"); - $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); - } - ); - // collapsing expanded-panes (upon the selection of html-select-options) if any - $(operationDataWrapper + " .expanded").each( - function () { - if ($(this).hasClass("expanded")) { - $(this).removeClass("expanded"); - } - $(this).slideUp(); - } - ); - // removing all entries of grid-input elements if exist - $(operationDataWrapper + " .grouped-array-input").each( - function () { - var gridInputs = $(this).find("[data-add-form-clone]"); - if (gridInputs.length > 0) { - gridInputs.remove(); - } - var helpTexts = $(this).find("[data-help-text=add-form]"); - if (helpTexts.length > 0) { - helpTexts.show(); - } - } - ); } } }); - - // adding support for cloning multiple profiles per feature with cloneable class definitions - $(advanceOperations).on("click", ".multi-view.add.enabled", function () { - // get a copy of .cloneable and create new .cloned div element - var cloned = "

    " + $(".cloneable", $(this).parent().parent()).html() + "
    "; - // append newly created .cloned div element to panel-body - $(this).parent().parent().append(cloned); - // enable remove action of newly cloned div element - $(".cloned", $(this).parent().parent()).each( - function () { - if ($(".multi-view.remove", this).hasClass("disabled")) { - $(".multi-view.remove", this).removeClass("disabled"); - } - if (!$(".multi-view.remove", this).hasClass("enabled")) { - $(".multi-view.remove", this).addClass("enabled"); - } - } - ); - }); - - $(advanceOperations).on("click", ".multi-view.remove.enabled", function () { - $(this).parent().remove(); - }); - - // enabling or disabling grouped-input based on the status of a parent check-box - $(advanceOperations).on("click", ".grouped-input", function () { - updateGroupedInputVisibility(this); - }); - - // add form entry click function for grid inputs - $(advanceOperations).on("click", "[data-click-event=add-form]", function () { - var addFormContainer = $("[data-add-form-container=" + $(this).attr("href") + "]"); - var clonedForm = $("[data-add-form=" + $(this).attr("href") + "]").clone().find("[data-add-form-element=clone]").attr("data-add-form-clone", $(this).attr("href")); - - // adding class .child-input to capture text-input-array-values - $("input, select", clonedForm).addClass("child-input"); - - $(addFormContainer).append(clonedForm); - setId(addFormContainer); - showHideHelpText(addFormContainer); - }); - - // remove form entry click function for grid inputs - $(advanceOperations).on("click", "[data-click-event=remove-form]", function () { - var addFormContainer = $("[data-add-form-container=" + $(this).attr("href") + "]"); - - $(this).closest("[data-add-form-element=clone]").remove(); - setId(addFormContainer); - showHideHelpText(addFormContainer); - }); }); \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js index 22bf73250..b6e08e785 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js @@ -16,6 +16,8 @@ * under the License. */ +var configuredOperations = []; + var androidOperationConstants = { "PASSCODE_POLICY_OPERATION": "passcode-policy", "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", @@ -523,13 +525,13 @@ var validatePolicyProfile = function () { }; /** - * Generates policy profile object which will be saved with the profile. + * Generates policy profile feature list which will be saved with the profile. * * This function will be invoked from the relevant cdmf unit at the time of policy creation. * * @returns {Array} profile payloads */ -var generatePolicyProfile = function () { +var generateProfileFeaturesList = function () { var profilePayloads = []; // traverses key by key in policy["profile"] var key; @@ -546,6 +548,24 @@ var generatePolicyProfile = function () { return profilePayloads; }; +/** + * Generates policy profile object which will be saved with the profile. + * + * This function will be invoked from the relevant cdmf unit at the time of policy creation. + * + * @returns {object} generated profile. + */ +var generatePolicyProfile = function () { + return androidOperationModule.generateProfile(configuredOperations); +}; + +/** + * Resets policy profile configurations. + */ +var resetPolicyProfile = function () { + configuredOperations = []; +}; + // Start of HTML embedded invoke methods var showAdvanceOperation = function (operation, button) { $(button).addClass('selected'); @@ -665,6 +685,23 @@ var slideDownPaneAgainstValueSet = function (selectElement, paneID, valueSet) { ); } }; + +var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneID, valueSet) { + var selectedValueOnChange = selectElement.value; + var slideDownVotes = 0; + for (var i = 0; i < valueSet.length; i++) { + if (selectedValueOnChange == valueSet[i]) { + slideDownVotes++; + } + } + var paneSelector = "#" + paneID; + if (slideDownVotes > 0) { + $(paneSelector).removeClass("hidden"); + } else { + $(paneSelector).addClass("hidden"); + } +}; + // End of HTML embedded invoke methods diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml index b1040e815..f2e041ed3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml @@ -22,7 +22,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java index b6376fbe9..28d35db86 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java @@ -22,8 +22,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; +import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.ProvisioningConfig; -import org.wso2.carbon.device.mgt.common.TaskOperation; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; @@ -54,7 +54,7 @@ public class AndroidDeviceManagementService implements DeviceManagementService { } @Override - public List getTasksForPlatform() { + public OperationMonitoringTaskConfig getOperationMonitoringConfig() { return null; } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao/impl/AndroidDeviceDAOImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao/impl/AndroidDeviceDAOImpl.java index db7307b2b..8df98747f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao/impl/AndroidDeviceDAOImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/dao/impl/AndroidDeviceDAOImpl.java @@ -159,7 +159,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{ stmt.setString(2, properties.get(AndroidPluginConstants.DEVICE_INFO)); stmt.setString(3, mobileDevice.getSerial()); stmt.setString(4, mobileDevice.getVendor()); - stmt.setString(5, mobileDevice.getMobileDeviceId()); + stmt.setString(5, properties.get(AndroidPluginConstants.MAC_ADDRESS)); stmt.setString(6, properties.get(AndroidPluginConstants.DEVICE_NAME)); stmt.setString(7, mobileDevice.getLatitude()); stmt.setString(8, mobileDevice.getLongitude()); @@ -167,8 +167,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{ stmt.setString(10, mobileDevice.getImsi()); stmt.setString(11, mobileDevice.getOsVersion()); stmt.setString(12, mobileDevice.getModel()); - stmt.setString(13, mobileDevice.getMobileDeviceId()); - stmt.setString(14, mobileDevice.getOsBuildDate()); + stmt.setString(13, mobileDevice.getOsBuildDate()); + stmt.setString(14, mobileDevice.getMobileDeviceId()); int rows = stmt.executeUpdate(); if (rows > 0) { status = true; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/gcm/GCMUtil.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/gcm/GCMUtil.java index c89671403..381468bdf 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/gcm/GCMUtil.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/gcm/GCMUtil.java @@ -51,7 +51,7 @@ public class GCMUtil { private static final Log log = LogFactory.getLog(GCMService.class); - private final static String GCM_ENDPOINT = "https://gcm-http.googleapis.com/gcm/send"; + private final static String GCM_ENDPOINT = "https://fcm.googleapis.com/fcm/send"; private static final String GCM_API_KEY = "gcmAPIKey"; private static final int TIME_TO_LIVE = 60; private static final int HTTP_STATUS_CODE_OK = 200; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/AndroidPluginConstants.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/AndroidPluginConstants.java index 48c30ff09..3cea5588c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/AndroidPluginConstants.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/AndroidPluginConstants.java @@ -37,7 +37,7 @@ public final class AndroidPluginConstants { public static final String VENDOR = "VENDOR"; public static final String OS_VERSION = "OS_VERSION"; public static final String OS_BUILD_DATE = "OS_BUILD_DATE"; - public static final String MAC_ADDRESS = "MAC_ADDRESS"; + public static final String MAC_ADDRESS = "MAC"; //Properties related to AD_FEATURE table public static final String ANDROID_FEATURE_ID = "ID"; diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index 3c67bfde6..2c23fb020 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index 454843ff4..7407d6504 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml index 9278bbf32..484fcff08 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml @@ -21,7 +21,7 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml @@ -351,6 +351,20 @@ io.swagger swagger-annotations + + + io.swagger + swagger-core + + + org.slf4j + slf4j-api + + + + + io.swagger + swagger-jaxrs org.slf4j diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/PluginConstants.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/PluginConstants.java index b399420af..e2959baf0 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/PluginConstants.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/PluginConstants.java @@ -189,7 +189,7 @@ public final class PluginConstants { public static final int MODEL_POSITION = 5; public static final int MAC_ADDRESS_POSITION = 7; public static final int RESOLUTION_POSITION = 8; - public static final int DEVICE_NAME_POSITION = 9; + public static final int DEVICE_NAME_POSITION = 10; public static final String SYNCML_DATA_ONE = "1"; public static final String SYNCML_DATA_ZERO = "0"; public static final String OS_VERSION = "OS_VERSION"; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/ConfigurationMgtService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/ConfigurationMgtService.java index ab4c2574b..a5f207595 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/ConfigurationMgtService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/ConfigurationMgtService.java @@ -54,7 +54,7 @@ import javax.ws.rs.core.Response; @Extension(properties = { @ExtensionProperty(name = "name", value = "Windows Configuration Management"), @ExtensionProperty(name = "context", - value = "/api/device-mgt/windows/v1.0/services/configuration"), + value = "/api/device-mgt/windows/v1.0/configuration"), }) } ), @@ -63,13 +63,13 @@ import javax.ws.rs.core.Response; } ) @Api(value = "Windows Configuration Management", - description = "This carries all the resources related to Windows configurations management functionalities") + description = "This carries all the resources related to Windows configurations management functionalities") @WebService -@Path("services/configuration") +@Path("/configuration") @Produces({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"}) public interface ConfigurationMgtService { - + @GET @ApiOperation( produces = MediaType.APPLICATION_JSON, @@ -80,9 +80,9 @@ public interface ConfigurationMgtService { tags = "Windows Configuration Management", authorizations = { @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/view", - description = "View Configurations") } + value = "permission", + scopes = {@AuthorizationScope(scope = "/device-mgt/platform-configurations/view", + description = "View Configurations")} ) } ) @@ -117,7 +117,12 @@ public interface ConfigurationMgtService { code = 500, message = "Internal Server Error. \n Server error occurred while fetching the Windows platform configuration.") }) - PlatformConfiguration getConfiguration() throws WindowsConfigurationException; + Response getConfiguration(@ApiParam( + name = "If-Modified-Since", + value = "Checks if the requested variant was modified, since the specified date-time.\n" + + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + + "Example: Mon, 05 Jan 2014 15:10:00 +0200", + required = false) @HeaderParam("If-Modified-Since") String ifModifiedSince); /** * Update Tenant Configurations for the specific Device type. @@ -136,9 +141,9 @@ public interface ConfigurationMgtService { tags = "Windows Configuration Management", authorizations = { @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/configurations/manage", - description = "Manage Configurations") } + value = "permission", + scopes = {@AuthorizationScope(scope = "/device-mgt/configurations/manage", + description = "Manage Configurations")} ) } ) @@ -175,11 +180,11 @@ public interface ConfigurationMgtService { message = "Internal Server Error. \n " + "Server error occurred while modifying the Windows platform configurations.") }) - Message updateConfiguration - ( @ApiParam( + Response updateConfiguration + (@ApiParam( name = "configuration", value = "The properties to update the Windows platform configurations.") - PlatformConfiguration configuration) throws WindowsConfigurationException; + PlatformConfiguration configuration) throws WindowsConfigurationException; @GET @Path("license") @@ -194,9 +199,9 @@ public interface ConfigurationMgtService { tags = "Windows Configuration Management", authorizations = { @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/windows", - description = "Enroll Device") } + value = "permission", + scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows", + description = "Enroll Device")} ) } ) @@ -236,7 +241,7 @@ public interface ConfigurationMgtService { name = "If-Modified-Since", value = "Checks if the requested variant was modified, since the specified date-time.\n" + "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200", + "Example: Mon, 05 Jan 2014 15:10:00 +0200.", required = false) @HeaderParam("If-Modified-Since") String ifModifiedSince) throws WindowsConfigurationException; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java index 5e325938c..8ff15ea34 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java @@ -18,13 +18,9 @@ package org.wso2.carbon.device.mgt.mobile.windows.api.services; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; +import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.Permission; +import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; import javax.jws.WebService; @@ -41,7 +37,7 @@ import java.util.List; * Interface for Admin operations persisting. This interface accepts operations added via UI. */ @Api(value = "Windows Device Management Administrative Service", - description = "Device management related admin APIs.") + description = "Device management related admin APIs.") @SwaggerDefinition( info = @Info( @@ -68,31 +64,313 @@ public interface DeviceManagementAdminService { @POST @Path("/lock-devices") - @Permission(name = "Lock Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock") - Response lock(@HeaderParam("Accept") String headerParam, List deviceIds) throws - WindowsDeviceEnrolmentException; + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Adding a Device Lock on Windows devices.", + notes = "Using this API you have the option of Device Windows device.", + response = Activity.class, + tags = "Windows Device Management Administrative Service", + authorizations = { + @Authorization( + value = "permission", + scopes = {@AuthorizationScope( + scope = "/device-mgt/devices/owning-device/operations/windows/lock", + description = "Lock Device")} + ) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the device lock operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified. \n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while locking the device.") + }) + Response lock(@HeaderParam("Accept") String headerParam, @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the AWindows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) List deviceIds) throws WindowsDeviceEnrolmentException; @POST @Path("/disenroll-devices") - @Permission(name = "Disenroll Device", permission = "/device-mgt/devices/disenroll/windows") - Response disenroll(@HeaderParam("Accept") String headerParam, List deviceIds) throws - WindowsDeviceEnrolmentException; + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Dis-enrol the windows Devices", + notes = "Dis-enroll on Android devices", + response = Activity.class, + tags = "Windows Device Management Administrative Service.", + authorizations = { + @Authorization( + value = "permission", + scopes = {@AuthorizationScope( + scope = "/device-mgt/devices/disenroll/windows", + description = "Dis-enroll the windows devices ")} + ) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the Dis-enroll operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a Dis-enroll operation.") + }) + Response disenroll(@HeaderParam("Accept") String headerParam, @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) List deviceIds) throws WindowsDeviceEnrolmentException; @POST @Path("/wipe-devices") - @Permission(name = "Wipe Device", permission = "/device-mgt/devices/owning-device/operations/windows/wipe") - Response wipe(@HeaderParam("Accept") String headerParam, List deviceIds) throws - WindowsDeviceEnrolmentException; + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Factory Resetting an Windows Device", + notes = "Factory rest or erase all the data stored on the Windows devices" + + "to restore them back to the original system.", + response = Activity.class, + tags = "Windows Device Management Administrative Service", + authorizations = { + @Authorization( + value = "permission", + scopes = {@AuthorizationScope( + scope = "/device-mgt/devices/owning-device/operations/windows/wipe", + description = "DeviceWipe")} + ) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the Data wipe operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified." + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding the Data wipe operation.")}) + Response wipe(@HeaderParam("Accept") String headerParam, @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) List deviceIds) throws WindowsDeviceEnrolmentException; @POST @Path("/ring-devices") - @Permission(name = "Ring Device", permission = "/device-mgt/devices/owning-device/operations/windows/ring") - Response ring(@HeaderParam("Accept") String headerParam, List deviceIds) throws - WindowsDeviceEnrolmentException; + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Ringing Windows Devices", + notes = "Ring Windows devices.", + response = Activity.class, + tags = "Windows Device Management Administrative Service", + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope( + scope = "/device-mgt/devices/owning-device/operations/windows/ring", + description = "Ring Device") } + ) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the device ring operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new device ring operation.") + }) + Response ring(@HeaderParam("Accept") String headerParam, @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) List deviceIds) throws WindowsDeviceEnrolmentException; @POST @Path("/lock-reset-devices") - @Permission(name = "Lock-Reset Device", permission = "/device-mgt/devices/owning-device/operations/windows/lock-reset") - Response lockReset(@HeaderParam("Accept") String acceptHeader, List deviceIds) - throws WindowsDeviceEnrolmentException; + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Lock reset on Windows devices", + notes = "Lock reset on Windows devices.Its use to reset the device pass code", + response = Activity.class, + tags = "Windows Device Management Administrative Service", + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope( + scope = "/device-mgt/devices/owning-device/operations/windows/lock-reset", + description = "Lock reset") } + ) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Created. \n Successfully scheduled the lock-reset operation.", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding adding a lock-reset operation.") + }) + // + Response lockReset(@HeaderParam("Accept") String acceptHeader, @ApiParam( + name = "deviceIDs", + value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + + "using comma separated values. ", + required = true) List deviceIds) throws WindowsDeviceEnrolmentException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementService.java deleted file mode 100644 index 63d046860..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementService.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * you may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.services; - -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; -import org.wso2.carbon.device.mgt.common.Device; -import org.wso2.carbon.device.mgt.common.license.mgt.License; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; - -import javax.jws.WebService; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.util.List; - -/** - * Windows Device Management REST-API implementation. All end points supports JSON, XMl with content negotiation. - */ -@Api(value = "Windows Device Management", - description = "This carries all the resources related to Windows device management functionalities") - -@SwaggerDefinition( - info = @Info( - version = "1.0.0", - title = "", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = "name", value = "Windows Device Management"), - @ExtensionProperty(name = "context", value = "/api/device-mgt/windows/v1.0/devices"), - }) - } - ), - tags = { - @Tag(name = "devicemgt_windows", description = "") - } -) -@WebService -@Path("/devices") -@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -public interface DeviceManagementService { - - /** - * Get all devices.Returns list of Windows devices registered in MDM. - * - * @return Returns retrieved devices. - * @throws WindowsConfigurationException occurred while retrieving all the devices from DB. - */ - @GET - List getAllDevices() throws WindowsConfigurationException; - - /** - * Fetch Windows device details of a given device Id. - * - * @param deviceId Device Id - * @return Returns retrieved device. - * @throws WindowsConfigurationException occurred while getting device from DB. - */ - @GET - @Path("{id}") - Device getDevice(@PathParam("id") String deviceId) throws WindowsConfigurationException; - - /** - * Update Windows device details of given device id. - * - * @param deviceId Device Id. - * @param device Device details to be updated. - * @return Returns the message whether device update or not. - * @throws WindowsConfigurationException occurred while updating the Device Info. - */ - @PUT - @Path("{id}") - Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException; - - /** - * Fetch the Licence agreement for specific windows platform. - * - * @return Returns License agreement. - * @throws WindowsConfigurationException occurred while getting licence for specific platform and Language. - */ - @GET - @Path("license") - @Produces("application/json") - License getLicense() throws WindowsConfigurationException; -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/PolicyManagementService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/PolicyManagementService.java deleted file mode 100644 index 387bac682..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/PolicyManagementService.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * you may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.services; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; - -import javax.jws.WebService; -import javax.ws.rs.*; - -/** - * Endpoint for Enforce Effective Policy. - */ -@WebService -@Produces({ "application/json", "application/xml"}) -@Consumes({"application/json", "application/xml"}) -public interface PolicyManagementService { - - /** - * Get the applicable effective policy for an enrolled windows device. - * - * @param deviceId Device Id - * @return Returns retrieved devices. - * @throws WindowsConfigurationException occurred while retrieving all the devices from DB. - */ - @GET - @Path("{deviceId}") - Message getEffectivePolicy(@HeaderParam("Accept") String acceptHeader, - @PathParam("deviceId") String deviceId) throws WindowsConfigurationException; -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java index 220d0e02d..1cea655c4 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/BSTProvider.java @@ -18,25 +18,104 @@ package org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst; +import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans.Credentials; +import javax.jws.WebService; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** * Interface for handling authentication request comes via MDM login page. */ + +@SwaggerDefinition( + info = @Info( + version = "1.0.0", + title = "", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "name", value = "Windows Binary security token provider"), + @ExtensionProperty(name = "context", + value = "/api/device-mgt/windows/v1.0/federated"), + }) + } + ), + tags = { + @Tag(name = "devicemgt_windows", description = "") + } +) +@Api(value = "Windows BST Management", + description = "This carries all the resources related to Windows Binary security token management.") +@WebService @Path("/bst") +@Produces({"application/json", "application/xml"}) +@Consumes({"application/json", "application/xml"}) public interface BSTProvider { @POST @Consumes(MediaType.APPLICATION_JSON) @Path("/authentication") @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows") - Response getBST(Credentials credentials) throws WindowsDeviceEnrolmentException; + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Getting Binary security token.", + notes = "Using this API to fetch Binary security token to call window enrollment and policy endpoints.", + tags = "BST Provider", + authorizations = { + @Authorization( + value = "permission", + scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows", + description = "Getting Binary security token for Windows enrollment " + + "and policy endpoints.")} + ) + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 200, message = "Ok. \n Successfully fetching the binary security token.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The URL of the added policy."), + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests.") + }), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while fetching Binary security token.") + }) + Response getBST(Credentials credentials) + throws WindowsDeviceEnrolmentException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/beans/Credentials.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/beans/Credentials.java index b7f8a9235..3444b141c 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/beans/Credentials.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/authbst/beans/Credentials.java @@ -18,6 +18,9 @@ package org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/DiscoveryService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/DiscoveryService.java index e105f4ee2..460f11f40 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/DiscoveryService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/DiscoveryService.java @@ -18,6 +18,8 @@ package org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery; +import io.swagger.annotations.*; +import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; import org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.beans.DiscoveryRequest; @@ -29,6 +31,8 @@ import javax.jws.WebResult; import javax.jws.WebService; import javax.ws.rs.GET; import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.ws.BindingType; import javax.xml.ws.RequestWrapper; @@ -38,23 +42,142 @@ import javax.xml.ws.soap.SOAPBinding; /** * Interface for Discovery service related operations. */ +@SwaggerDefinition( + info = @Info( + version = "1.0.0", + title = "", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "name", value = "Windows Discovery service provider"), + @ExtensionProperty(name = "context", + value = "/api/device-mgt/windows/v1.0/discovery/post"), + }) + } + ), + tags = { + @Tag(name = "devicemgt_windows", description = "") + } +) +@Api(value = "Windows Discovery service", + description = "This carries all the resources related to Windows Discovery service.") @WebService(targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE, name = "IDiscoveryService") @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) public interface DiscoveryService { - @POST + @ApiOperation( + httpMethod = "POST", + value = "Discovering the server Enrollment policy and Enrollment service Endpoints.", + notes = "Using this API to discover the Enrollment policy,Enrollment service and " + + "federated login page server endpoints in the server. ", + response = DiscoveryResponse.class, + tags = "Windows Device Enrollment.", + authorizations = { + @Authorization( + value = "permission", + scopes = {@AuthorizationScope( + scope = "/device-mgt/devices/enroll/windows", + description = "Discover the service endpoints.")} + ) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 200, + message = "Ok. \n Accepted and getting server endpoints.", + response = DiscoveryResponse.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified. \n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URLr.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while fetching the server endpoints.") + }) @RequestWrapper(localName = "Discover", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) @WebMethod(operationName = "Discover") @ResponseWrapper(localName = "DiscoverResponse", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) void discover( @WebParam(name = "request", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) - DiscoveryRequest request, + @ApiParam( + name = "DiscoveryRequest", + value = "Discovery service SOAP request.") + DiscoveryRequest request, @WebParam(mode = WebParam.Mode.OUT, name = "DiscoverResult", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) - javax.xml.ws.Holder response + javax.xml.ws.Holder response ) throws WindowsDeviceEnrolmentException; + + @ApiOperation( + httpMethod = "GET", + value = "Device ping the server to check whether it is running or not.", + notes = ".", + tags = "Windows Discovery service.", + authorizations = { + @Authorization( + value = "permission", + scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows", + description = "Ping the Discovery service")} + ) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Server is already running."), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified " + + "in the location header.", + responseHeaders = { + @ResponseHeader(name = "Content-Location", + description = "Source URL of the document.") + }), + @ApiResponse( + code = 304, + message = "Not Modified. \n " + + "Empty body because the client already has the latest version of " + + "the requested resource."), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error. You must provide" + + " the device identifier. Additionally, the device identifier can be combined" + + " with either the device type" + + " OR the from and to date."), + @ApiResponse( + code = 404, + message = "Not Found. \n The specified resource does not exist."), + @ApiResponse( + code = 500, + message = "Error occurred while pinging the server.") + }) @GET @WebMethod @WebResult() diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/beans/DiscoveryRequest.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/beans/DiscoveryRequest.java index d397e3b57..e5f123d01 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/beans/DiscoveryRequest.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/beans/DiscoveryRequest.java @@ -18,6 +18,9 @@ package org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -26,15 +29,21 @@ import java.io.Serializable; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DiscoveryRequest") +@ApiModel(value = "DiscoveryRequest", + description = "Discover request related information.") @SuppressWarnings("unused") public class DiscoveryRequest implements Serializable { + @ApiModelProperty(name = "emailId", value = "User email address which is submitted to the workplace app" + + " once sign in .", required = true) @XmlElement(name = "EmailAddress", required = true) private String emailId; + @ApiModelProperty(name = "version", value = "OS version on the Windows Device.", required = true) @XmlElement(name = "RequestVersion") private String version; + @ApiModelProperty(name = "deviceType", value = "Type of the Device(LapTop/Mobile Device).", required = true) @XmlElement(name = "DeviceType") private String deviceType; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/ConfigurationMgtServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/ConfigurationMgtServiceImpl.java index 1802df8dc..c2a6607b3 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/ConfigurationMgtServiceImpl.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/ConfigurationMgtServiceImpl.java @@ -29,7 +29,6 @@ import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.UnexpectedServerErrorException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; import org.wso2.carbon.device.mgt.mobile.windows.api.services.ConfigurationMgtService; @@ -55,17 +54,17 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService { * @throws WindowsConfigurationException */ @GET - public PlatformConfiguration getConfiguration() throws WindowsConfigurationException { + public Response getConfiguration(@HeaderParam("If-Modified-Since") String ifModifiedSince) { String msg; - PlatformConfiguration tenantConfiguration; + PlatformConfiguration platformConfiguration; List configs; try { - tenantConfiguration = WindowsAPIUtils.getDeviceManagementService(). + platformConfiguration = WindowsAPIUtils.getDeviceManagementService(). getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - if (tenantConfiguration != null) { - configs = tenantConfiguration.getConfiguration(); + if (platformConfiguration != null) { + configs = platformConfiguration.getConfiguration(); } else { - tenantConfiguration = new PlatformConfiguration(); + platformConfiguration = new PlatformConfiguration(); configs = new ArrayList<>(); } @@ -79,28 +78,29 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService { entry.setName(PluginConstants.TenantConfigProperties.LICENSE_KEY); entry.setValue(license.getText()); configs.add(entry); - tenantConfiguration.setConfiguration(configs); + platformConfiguration.setConfiguration(configs); } } catch (DeviceManagementException e) { msg = "Error occurred while retrieving the Windows tenant configuration"; log.error(msg, e); - throw new WindowsConfigurationException(msg, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); } - return tenantConfiguration; + return Response.status(Response.Status.OK).entity(platformConfiguration).build(); } /** * Update Tenant Configurations for the specific Device type. * - * @param configuration Tenant configurations to be updated. + * @param configurations to be updated. * @return Response message. * @throws WindowsConfigurationException */ @PUT - public Message updateConfiguration(PlatformConfiguration configuration) throws WindowsConfigurationException { + public Response updateConfiguration(PlatformConfiguration windowsPlatformConfiguration) throws WindowsConfigurationException { String message; - Message responseMsg = new Message(); ConfigurationEntry licenseEntry = null; + PlatformConfiguration configuration = new PlatformConfiguration(); try { configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); List configs = configuration.getConfiguration(); @@ -123,14 +123,15 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService { configuration.setConfiguration(configs); WindowsAPIUtils.getDeviceManagementService().saveConfiguration(configuration); Response.status(Response.Status.CREATED); - responseMsg.setResponseMessage("Windows platform configuration succeeded."); - responseMsg.setResponseCode(Response.Status.CREATED.toString()); } catch (DeviceManagementException e) { message = "Error occurred while modifying configuration settings of Windows platform."; log.error(message, e); - throw new WindowsConfigurationException(message, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(message).build()); } - return responseMsg; + return Response.status(Response.Status.OK). + entity("Windows platform configuration has been updated successfully.").build(); + } @GET diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/DeviceManagementServiceImpl.java deleted file mode 100644 index 6829c6cb6..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/DeviceManagementServiceImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * you may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.services.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.common.Device; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.license.mgt.License; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.DeviceManagementService; - -import javax.jws.WebService; -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.List; - -/** - * Windows Device Management REST-API implementation. - * All end points supports JSON, XMl with content negotiation. - */ -@WebService -@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -public class DeviceManagementServiceImpl implements DeviceManagementService { - - - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.DeviceManagementServiceImpl.class); - - /** - * Get all devices.Returns list of Windows devices registered in MDM. - * - * @return Returns retrieved devices. - * @throws WindowsConfigurationException occurred while retrieving all the devices from DB. - */ - @GET - public List getAllDevices() throws WindowsConfigurationException { - String msg; - List devices; - try { - devices = WindowsAPIUtils.getDeviceManagementService(). - getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - } catch (DeviceManagementException e) { - msg = "Error occurred while fetching the device list."; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } - return devices; - } - - /** - * Fetch Windows device details of a given device Id. - * - * @param deviceId Device Id - * @return Returns retrieved device. - * @throws WindowsConfigurationException occurred while getting device from DB. - */ - @GET - @Path("{id}") - public Device getDevice(@PathParam("id") String deviceId) throws WindowsConfigurationException { - String msg; - Device device; - try { - DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(deviceId); - device = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); - if (device == null) { - Response.status(Response.Status.NOT_FOUND); - } - } catch (DeviceManagementException e) { - msg = "Error occurred while fetching the device information."; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } - return device; - } - - /** - * Update Windows device details of given device id. - * - * @param deviceId Device Id. - * @param device Device details to be updated. - * @return Returns the message whether device update or not. - * @throws WindowsConfigurationException occurred while updating the Device Info. - */ - @PUT - @Path("{id}") - public Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException { - String msg; - Message responseMessage = new Message(); - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(deviceId); - deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - boolean isUpdated; - try { - device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - isUpdated = WindowsAPIUtils.getDeviceManagementService().updateDeviceInfo(deviceIdentifier, device); - if (isUpdated) { - Response.status(Response.Status.ACCEPTED); - responseMessage.setResponseMessage("Device information has modified successfully."); - } else { - Response.status(Response.Status.NOT_MODIFIED); - responseMessage.setResponseMessage("Device not found for the update."); - } - } catch (DeviceManagementException e) { - msg = "Error occurred while modifying the device information."; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } - return responseMessage; - } - - /** - * Fetch the Licence agreement for specific windows platform. - * - * @return Returns License agreement. - * @throws WindowsConfigurationException occurred while getting licence for specific platform and Language. - */ - @GET - @Path("license") - @Produces("application/json") - public License getLicense() throws WindowsConfigurationException { - License license; - try { - license = - WindowsAPIUtils.getDeviceManagementService().getLicense( - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, - DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US); - } catch (DeviceManagementException e) { - String msg = "Error occurred while retrieving the license configured for Windows device enrollment"; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } - return license; - } -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/PolicyManagementServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/PolicyManagementServiceImpl.java deleted file mode 100644 index fa5c8c438..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/impl/PolicyManagementServiceImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * you may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.services.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.PolicyManagementService; -import org.wso2.carbon.policy.mgt.common.Policy; -import org.wso2.carbon.policy.mgt.common.PolicyManagementException; -import org.wso2.carbon.policy.mgt.core.PolicyManagerService; - -import javax.jws.WebService; -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -@WebService -@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -public class PolicyManagementServiceImpl implements PolicyManagementService { - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.PolicyManagementServiceImpl.class); - - @GET - @Path("{deviceId}") - public Message getEffectivePolicy(@HeaderParam("Accept") String acceptHeader, - @PathParam("deviceId") String deviceId) throws WindowsConfigurationException { - - DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(deviceId); - Message responseMessage = new Message(); - Policy policy; - try { - PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService(); - policy = policyManagerService.getEffectivePolicy(deviceIdentifier); - if (policy == null) { - responseMessage.setResponseCode(Response.Status.NO_CONTENT.toString()); - responseMessage.setResponseMessage("No effective policy found"); - return responseMessage; - } else { - responseMessage.setResponseCode(Response.Status.OK.toString()); - responseMessage.setResponseMessage("Effective policy added to operation"); - return responseMessage; - } - - } catch (PolicyManagementException e) { - String msg = "Error occurred while getting the policy."; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } - } -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/SyncmlService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/SyncmlService.java index f24898002..37194987b 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/SyncmlService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/SyncmlService.java @@ -18,8 +18,10 @@ package org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml; +import io.swagger.annotations.*; import org.w3c.dom.Document; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; +import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; @@ -35,14 +37,85 @@ import javax.ws.rs.core.Response; /** * Interface for Syncml message flow. */ +@SwaggerDefinition( + info = @Info( + version = "1.0.0", + title = "", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "name", value = "Syncml Endpoint"), + @ExtensionProperty(name = "context", + value = "/api/device-mgt/windows/v1.0/syncml"), + }) + } + ), + tags = { + @Tag(name = "devicemgt_windows", description = "") + } +) +@Api(value = "Windows syncml service", + description = "This carries all the resources related to Windows syncml message flow.") @Path("/devicemanagement") public interface SyncmlService { @Path("/request") @POST - @Consumes({ PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML}) + @Consumes({PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML}) @Produces(PluginConstants.SYNCML_MEDIA_TYPE) + @ApiOperation( + httpMethod = "POST", + value = "Getting pending operations for Windows device.", + notes = "Using this API to fetching more information to enroll the Device and " + + "getting pending operations.", + tags = "Windows Device Management Administrative Service", + authorizations = { + @Authorization( + value = "permission", + scopes = {@AuthorizationScope( + scope = "/device-mgt/devices/enroll/windows", + description = "Getting pending operations and " + + "device information to enroll the device")} + ) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Ok. \n Successfully getting pending operations.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified. \n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while getting pending operations.") + }) Response getResponse(Document request) throws WindowsDeviceEnrolmentException, WindowsOperationException, - NotificationManagementException, WindowsConfigurationException; + NotificationManagementException, WindowsConfigurationException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/impl/SyncmlServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/impl/SyncmlServiceImpl.java index e431d9c96..1bd6c827a 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/impl/SyncmlServiceImpl.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/impl/SyncmlServiceImpl.java @@ -235,7 +235,6 @@ public class SyncmlServiceImpl implements SyncmlService { String devLang; String vendor; String macAddress; - String resolution; String modVersion; boolean status = false; String user; @@ -287,7 +286,6 @@ public class SyncmlServiceImpl implements SyncmlService { vendor = itemList.get(PluginConstants.SyncML.VENDOR_POSITION).getData(); devMod = itemList.get(PluginConstants.SyncML.MODEL_POSITION).getData(); macAddress = itemList.get(PluginConstants.SyncML.MAC_ADDRESS_POSITION).getData(); - resolution = itemList.get(PluginConstants.SyncML.RESOLUTION_POSITION).getData(); deviceName = itemList.get(PluginConstants.SyncML.DEVICE_NAME_POSITION).getData(); DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(syncmlDocument. getHeader().getSource().getLocURI()); @@ -320,24 +318,16 @@ public class SyncmlServiceImpl implements SyncmlService { macAddressProperty.setValue(macAddress); existingProperties.add(macAddressProperty); -// Device.Property resolutionProperty = new Device.Property(); -// resolutionProperty.setName(PluginConstants.SyncML.DEVICE_INFO); -// resolutionProperty.setValue("null"); -// existingProperties.add(resolutionProperty); - - Device.Property deviceNameProperty = new Device.Property(); - deviceNameProperty.setName(PluginConstants.SyncML.DEVICE_NAME); - deviceNameProperty.setValue(deviceName); - existingProperties.add(deviceNameProperty); - Device.Property deviceModelProperty = new Device.Property(); - deviceNameProperty.setName(PluginConstants.SyncML.MODEL); - deviceNameProperty.setValue(devMod); + deviceModelProperty.setName(PluginConstants.SyncML.MODEL); + deviceModelProperty.setValue(devMod); existingProperties.add(deviceModelProperty); + existingDevice.setName(deviceName); existingDevice.setProperties(existingProperties); existingDevice.setDeviceIdentifier(syncmlDocument.getHeader().getSource().getLocURI()); existingDevice.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); + status = WindowsAPIUtils.getDeviceManagementService().modifyEnrollment(existingDevice); // call effective policy for the enrolling device. PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService(); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/CertificateEnrollmentService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/CertificateEnrollmentService.java index 5d1fb6289..2bdf78128 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/CertificateEnrollmentService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/CertificateEnrollmentService.java @@ -17,6 +17,7 @@ */ package org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep; +import io.swagger.annotations.*; import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; @@ -26,6 +27,11 @@ import org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.Reques import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import javax.xml.ws.BindingType; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; @@ -35,6 +41,24 @@ import java.io.UnsupportedEncodingException; /** * Interface of WSTEP implementation. */ +@SwaggerDefinition( + info = @Info( + version = "1.0.0", + title = "", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "name", value = "Windows enrollment service provider"), + @ExtensionProperty(name = "context", + value = "/api/device-mgt/windows/v1.0/deviceenrolment/wstep"), + }) + } + ), + tags = { + @Tag(name = "devicemgt_windows", description = "") + } +) +@Api(value = "Windows Enrollment service Management", + description = "This carries all the resources related to Windows enrollment service.") @WebService(targetNamespace = PluginConstants.DEVICE_ENROLLMENT_SERVICE_TARGET_NAMESPACE, name = "wstep") @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) public interface CertificateEnrollmentService { @@ -44,20 +68,73 @@ public interface CertificateEnrollmentService { @WebMethod(operationName = "RequestSecurityToken") @ResponseWrapper(localName = "RequestSecurityTokenResponseCollection", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) + @POST + @ApiOperation( + httpMethod = "POST", + value = "Signing the certificate signing request(CSR) and provide request security token response.", + notes = "Using this API to fetching more information to enroll the Device and " + + "getting pending operations.", + tags = "Windows Device Enrollment Service.", + authorizations = { + @Authorization( + value = "permission", + scopes = {@AuthorizationScope( + scope = "/device-mgt/devices/enroll/windows", + description = "GSigning the certificate signing request(CSR) " + + "and provide request security token response")} + ) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 200, + message = "Ok.Successfully signed the CSR.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified. \n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while Signing the CSR.") + }) void requestSecurityToken( @WebParam(name = "TokenType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - String tokenType, + String tokenType, @WebParam(name = "RequestType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - String requestType, + String requestType, @WebParam(name = "BinarySecurityToken", targetNamespace = PluginConstants .WS_SECURITY_TARGET_NAMESPACE) - String binarySecurityToken, + String binarySecurityToken, @WebParam(name = "AdditionalContext", targetNamespace = PluginConstants .SOAP_AUTHORIZATION_TARGET_NAMESPACE) - AdditionalContext additionalContext, + AdditionalContext additionalContext, @WebParam(mode = WebParam.Mode.OUT, name = "RequestSecurityTokenResponse", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - javax.xml.ws.Holder response) throws - WindowsDeviceEnrolmentException, UnsupportedEncodingException, - WAPProvisioningException; + javax.xml.ws.Holder response) throws + WindowsDeviceEnrolmentException, UnsupportedEncodingException, WAPProvisioningException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java index a0520028b..8e587bfc0 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java @@ -51,6 +51,7 @@ import org.xml.sax.SAXException; import javax.annotation.Resource; import javax.jws.WebService; import javax.servlet.ServletContext; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -233,9 +234,8 @@ public class CertificateEnrollmentServiceImpl implements CertificateEnrollmentSe signedCertEncodedString = base64Encoder.encodeAsString(signedCertificate.getEncoded()); DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder; - - builder = domFactory.newDocumentBuilder(); + domFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder builder = domFactory.newDocumentBuilder(); Document document = builder.parse(wapProvisioningFilePath); NodeList wapParm = document.getElementsByTagName(PluginConstants.CertificateEnrolment.PARM); Node caCertificatePosition = wapParm.item(PluginConstants.CertificateEnrolment.CA_CERTIFICATE_POSITION); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/xcep/CertificateEnrollmentPolicyService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/xcep/CertificateEnrollmentPolicyService.java index 86f900867..70d6cbb21 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/xcep/CertificateEnrollmentPolicyService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/xcep/CertificateEnrollmentPolicyService.java @@ -18,12 +18,18 @@ package org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep; +import io.swagger.annotations.*; import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; import org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.beans.*; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.ws.BindingType; import javax.xml.ws.Holder; @@ -34,6 +40,25 @@ import javax.xml.ws.soap.SOAPBinding; /** * Interface for MS-XCEP implementation. */ + +@SwaggerDefinition( + info = @Info( + version = "1.0.0", + title = "", + extensions = { + @io.swagger.annotations.Extension(properties = { + @ExtensionProperty(name = "name", value = "Windows Enrollment policy service"), + @ExtensionProperty(name = "context", + value = "/api/device-mgt/windows/v1.0/certificatepolicy/xcep"), + }) + } + ), + tags = { + @Tag(name = "devicemgt_windows", description = "") + } +) +@Api(value = "Windows enrollment policy Management", + description = "This carries all the resources related to Windows enrollment policy.") @WebService(targetNamespace = PluginConstants.CERTIFICATE_ENROLLMENT_POLICY_SERVICE_TARGET_NAMESPACE, name = "IPolicy") @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) @@ -45,7 +70,64 @@ public interface CertificateEnrollmentPolicyService { @WebMethod(operationName = "GetPolicies") @ResponseWrapper(localName = "GetPoliciesResponse", targetNamespace = PluginConstants. ENROLLMENT_POLICY_TARGET_NAMESPACE, className = PluginConstants. - RESPONSE_WRAPPER_CLASS_NAME) void getPolicies( + RESPONSE_WRAPPER_CLASS_NAME) + @POST + @Consumes({PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML}) + @Produces(PluginConstants.SYNCML_MEDIA_TYPE) + @ApiOperation( + httpMethod = "POST", + value = "Getting pending operations for Windows device.", + notes = "Using this API to fetching more information to enroll the Device and " + + "getting pending operations.", + tags = "Windows Device Management Administrative Service", + authorizations = { + @Authorization( + value = "permission", + scopes = {@AuthorizationScope( + scope = "/device-mgt/devices/enroll/windows", + description = "Getting pending operations and " + + "device information to enroll the device")} + ) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Ok. \n Successfully getting pending operations.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified. \n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while getting pending operations.") + }) + void getPolicies( @WebParam(name = "client", targetNamespace = PluginConstants. ENROLLMENT_POLICY_TARGET_NAMESPACE) Client client, diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 2d54d092b..a81ccfd47 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -33,7 +33,12 @@ + + + + + @@ -88,43 +93,39 @@ - - - - - - - - - - - - - + + + + + + + + + + + + @@ -132,32 +133,12 @@ + - - - - - - - - - - - - - - - - - - - - - - + @@ -186,7 +167,21 @@ - + + + + + + + + + + + + + + + - - diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml index 8087d45a0..0921d588b 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml @@ -43,7 +43,7 @@ JAXServlet-windows - /services/* + /* 60 @@ -66,7 +66,7 @@ nonSecuredEndPoints - /services/discovery/get,/services/discovery/post,/services/certificatepolicy/xcep, - ,/services/deviceenrolment/wstep,/services/syncml/devicemanagement/request + /discovery/get,/discovery/post,/certificatepolicy/xcep, + ,/deviceenrolment/wstep,/syncml/devicemanagement/request \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml index 98a70a81a..c3f7d955f 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml @@ -23,13 +23,13 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.ui - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT WSO2 Carbon - Mobile Windows UI pom diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/public/js/operation-mod.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/public/js/operation-mod.js index b6b0795ca..4e5d74f56 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/public/js/operation-mod.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/public/js/operation-mod.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -16,17 +16,10 @@ * under the License. */ -var operationModule = function () { +var windowsOperationModule = function () { var publicMethods = {}; var privateMethods = {}; - // Constants to define platform types available - var platformTypeConstants = { - "ANDROID": "android", - "IOS": "ios", - "WINDOWS": "windows" - }; - // Constants to define operation types available var operationTypeConstants = { "PROFILE": "profile", @@ -34,57 +27,6 @@ var operationModule = function () { "COMMAND": "command" }; - // Constants to define Android Operation Constants - var androidOperationConstants = { - "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", - "VPN_OPERATION_CODE": "VPN", - "CAMERA_OPERATION_CODE": "CAMERA", - "ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE", - "WIFI_OPERATION_CODE": "WIFI", - "WIPE_OPERATION_CODE": "WIPE_DATA", - "NOTIFICATION_OPERATION_CODE": "NOTIFICATION", - "WORK_PROFILE_CODE": "WORK_PROFILE", - "CHANGE_LOCK_CODE_OPERATION_CODE": "CHANGE_LOCK_CODE", - "LOCK_OPERATION_CODE": "DEVICE_LOCK", - "UPGRADE_FIRMWARE": "UPGRADE_FIRMWARE", - "DISALLOW_ADJUST_VOLUME": "DISALLOW_ADJUST_VOLUME", - "DISALLOW_CONFIG_BLUETOOTH": "DISALLOW_CONFIG_BLUETOOTH", - "DISALLOW_CONFIG_CELL_BROADCASTS": "DISALLOW_CONFIG_CELL_BROADCASTS", - "DISALLOW_CONFIG_CREDENTIALS": "DISALLOW_CONFIG_CREDENTIALS", - "DISALLOW_CONFIG_MOBILE_NETWORKS": "DISALLOW_CONFIG_MOBILE_NETWORKS", - "DISALLOW_CONFIG_TETHERING": "DISALLOW_CONFIG_TETHERING", - "DISALLOW_CONFIG_VPN": "DISALLOW_CONFIG_VPN", - "DISALLOW_CONFIG_WIFI": "DISALLOW_CONFIG_WIFI", - "DISALLOW_APPS_CONTROL": "DISALLOW_APPS_CONTROL", - "DISALLOW_CREATE_WINDOWS": "DISALLOW_CREATE_WINDOWS", - "DISALLOW_CROSS_PROFILE_COPY_PASTE": "DISALLOW_CROSS_PROFILE_COPY_PASTE", - "DISALLOW_DEBUGGING_FEATURES": "DISALLOW_DEBUGGING_FEATURES", - "DISALLOW_FACTORY_RESET": "DISALLOW_FACTORY_RESET", - "DISALLOW_ADD_USER": "DISALLOW_ADD_USER", - "DISALLOW_INSTALL_APPS": "DISALLOW_INSTALL_APPS", - "DISALLOW_INSTALL_UNKNOWN_SOURCES": "DISALLOW_INSTALL_UNKNOWN_SOURCES", - "DISALLOW_MODIFY_ACCOUNTS": "DISALLOW_MODIFY_ACCOUNTS", - "DISALLOW_MOUNT_PHYSICAL_MEDIA": "DISALLOW_MOUNT_PHYSICAL_MEDIA", - "DISALLOW_NETWORK_RESET": "DISALLOW_NETWORK_RESET", - "DISALLOW_OUTGOING_BEAM": "DISALLOW_OUTGOING_BEAM", - "DISALLOW_OUTGOING_CALLS": "DISALLOW_OUTGOING_CALLS", - "DISALLOW_REMOVE_USER": "DISALLOW_REMOVE_USER", - "DISALLOW_SAFE_BOOT": "DISALLOW_SAFE_BOOT", - "DISALLOW_SHARE_LOCATION": "DISALLOW_SHARE_LOCATION", - "DISALLOW_SMS": "DISALLOW_SMS", - "DISALLOW_UNINSTALL_APPS": "DISALLOW_UNINSTALL_APPS", - "DISALLOW_UNMUTE_MICROPHONE": "DISALLOW_UNMUTE_MICROPHONE", - "DISALLOW_USB_FILE_TRANSFER": "DISALLOW_USB_FILE_TRANSFER", - "ALLOW_PARENT_PROFILE_APP_LINKING": "ALLOW_PARENT_PROFILE_APP_LINKING", - "ENSURE_VERIFY_APPS": "ENSURE_VERIFY_APPS", - "AUTO_TIME": "AUTO_TIME", - "SET_SCREEN_CAPTURE_DISABLED": "SET_SCREEN_CAPTURE_DISABLED", - "SET_STATUS_BAR_DISABLED": "SET_STATUS_BAR_DISABLED", - "APPLICATION_OPERATION_CODE": "APP-RESTRICTION", - "SYSTEM_UPDATE_POLICY_CODE": "SYSTEM_UPDATE_POLICY", - "KIOSK_APPS_CODE": "KIOSK_APPS" - }; - // Constants to define Windows Operation Constants var windowsOperationConstants = { "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", @@ -94,1036 +36,6 @@ var operationModule = function () { "CHANGE_LOCK_CODE_OPERATION_CODE": "CHANGE_LOCK_CODE" }; - // Constants to define iOS Operation Constants - var iosOperationConstants = { - "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", - "RESTRICTIONS_OPERATION_CODE": "RESTRICTION", - "VPN_OPERATION_CODE": "VPN", - "WIFI_OPERATION_CODE": "WIFI", - "EMAIL_OPERATION_CODE": "EMAIL", - "AIRPLAY_OPERATION_CODE": "AIR_PLAY", - "LDAP_OPERATION_CODE": "LDAP", - "DOMAIN_OPERATION_CODE": "DOMAIN", - "CALENDAR_OPERATION_CODE": "CALDAV", - "NOTIFICATION_OPERATION_CODE": "NOTIFICATION", - "CALENDAR_SUBSCRIPTION_OPERATION_CODE": "CALENDAR_SUBSCRIPTION", - "APN_OPERATION_CODE": "APN", - "CELLULAR_OPERATION_CODE": "CELLULAR", - "PER_APP_VPN_OPERATION_CODE": "PER_APP_VPN", - "APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE": "APP_TO_PER_APP_VPN_MAPPING" - }; - - publicMethods.getIOSServiceEndpoint = function (operationCode) { - var featureMap = { - "DEVICE_LOCK": "lock", - "LOCATION": "location", - "ENTERPRISE_WIPE": "enterprise-wipe", - "NOTIFICATION": "notification", - "RING": "ring" - }; - return "/api/device-mgt/ios/v1.0/admin/devices/" + featureMap[operationCode]; - }; - - /** - * Convert the ios platform specific code to the generic payload. - * TODO: think of the possibility to follow a pattern to the key name (namespace?) - * @param operationCode - * @param operationPayload - * @returns {{}} - */ - privateMethods.generateGenericPayloadFromIOSPayload = function (operationCode, operationPayload) { - var payload = {}; - operationPayload = JSON.parse(operationPayload); - switch (operationCode) { - case iosOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - payload = { - "passcodePolicyForcePIN": operationPayload["forcePIN"], - "passcodePolicyAllowSimple": operationPayload["allowSimple"], - "passcodePolicyRequireAlphanumeric": operationPayload["requireAlphanumeric"], - "passcodePolicyMinLength": operationPayload["minLength"], - "passcodePolicyMinComplexChars": operationPayload["minComplexChars"], - "passcodePolicyMaxPasscodeAgeInDays": operationPayload["maxPINAgeInDays"], - "passcodePolicyPasscodeHistory": operationPayload["pinHistory"], - "passcodePolicyMaxAutoLock": operationPayload["maxInactivity"], - "passcodePolicyGracePeriod": operationPayload["maxGracePeriod"], - "passcodePolicyMaxFailedAttempts": operationPayload["maxFailedAttempts"] - }; - break; - case iosOperationConstants["DOMAIN_OPERATION_CODE"]: - payload = { - "emailDomains": operationPayload["emailDomains"], - "webDomains": operationPayload["webDomains"] - }; - break; - case iosOperationConstants["RESTRICTIONS_OPERATION_CODE"]: - payload = { - "restrictionsAllowAccountModification": operationPayload["allowAccountModification"], - "restrictionsAllowAddingGameCenterFriends": operationPayload["allowAddingGameCenterFriends"], - "restrictionsAllowAirDrop": operationPayload["allowAirDrop"], - "restrictionsAllowAppCellularDataModification": operationPayload["allowAppCellularDataModification"], - "restrictionsAllowAppInstallation": operationPayload["allowAppInstallation"], - "restrictionsAllowAppRemoval": operationPayload["allowAppRemoval"], - "restrictionsAllowAssistant": operationPayload["allowAssistant"], - "restrictionsAllowAssistantUserGeneratedContent": operationPayload["allowAssistantUserGeneratedContent"], - "restrictionsAllowAssistantWhileLocked": operationPayload["allowAssistantWhileLocked"], - "restrictionsAllowBookstore": operationPayload["allowBookstore"], - "restrictionsAllowBookstoreErotica": operationPayload["allowBookstoreErotica"], - "restrictionsAllowCamera": operationPayload["allowCamera"], - "restrictionsAllowChat": operationPayload["allowChat"], - "restrictionsAllowCloudBackup": operationPayload["allowCloudBackup"], - "restrictionsAllowCloudDocumentSync": operationPayload["allowCloudDocumentSync"], - "restrictionsAllowCloudKeychainSync": operationPayload["allowCloudKeychainSync"], - "restrictionsAllowDiagnosticSubmission": operationPayload["allowDiagnosticSubmission"], - "restrictionsAllowExplicitContent": operationPayload["allowExplicitContent"], - "restrictionsAllowFindMyFriendsModification": operationPayload["allowFindMyFriendsModification"], - "restrictionsAllowFingerprintForUnlock": operationPayload["allowFingerprintForUnlock"], - "restrictionsAllowGameCenter": operationPayload["allowGameCenter"], - "restrictionsAllowGlobalBackgroundFetchWhenRoaming": operationPayload["allowGlobalBackgroundFetchWhenRoaming"], - "restrictionsAllowInAppPurchases": operationPayload["allowInAppPurchases"], - "restrictionsAllowLockScreenControlCenter": operationPayload["allowLockScreenControlCenter"], - "restrictionsAllowHostPairing": operationPayload["allowHostPairing"], - "restrictionsAllowLockScreenNotificationsView": operationPayload["allowLockScreenNotificationsView"], - "restrictionsAllowLockScreenTodayView": operationPayload["allowLockScreenTodayView"], - "restrictionsAllowMultiplayerGaming": operationPayload["allowMultiplayerGaming"], - "restrictionsAllowOpenFromManagedToUnmanaged": operationPayload["allowOpenFromManagedToUnmanaged"], - "restrictionsAllowOpenFromUnmanagedToManaged": operationPayload["allowOpenFromUnmanagedToManaged"], - "restrictionsAllowOTAPKIUpdates": operationPayload["allowOTAPKIUpdates"], - "restrictionsAllowPassbookWhileLocked": operationPayload["allowPassbookWhileLocked"], - "restrictionsAllowPhotoStream": operationPayload["allowPhotoStream"], - "restrictionsAllowSafari": operationPayload["allowSafari"], - "restrictionsSafariAllowAutoFill": operationPayload["safariAllowAutoFill"], - "restrictionsSafariForceFraudWarning": operationPayload["safariForceFraudWarning"], - "restrictionsSafariAllowJavaScript": operationPayload["safariAllowJavaScript"], - "restrictionsSafariAllowPopups": operationPayload["safariAllowPopups"], - "restrictionsAllowScreenShot": operationPayload["allowScreenShot"], - "restrictionsAllowSharedStream": operationPayload["allowSharedStream"], - "restrictionsAllowUIConfigurationProfileInstallation": operationPayload["allowUIConfigurationProfileInstallation"], - "restrictionsAllowUntrustedTLSPrompt": operationPayload["allowUntrustedTLSPrompt"], - "restrictionsAllowVideoConferencing": operationPayload["allowVideoConferencing"], - "restrictionsAllowVoiceDialing": operationPayload["allowVoiceDialing"], - "restrictionsAllowYouTube": operationPayload["allowYouTube"], - "restrictionsAllowITunes": operationPayload["allowiTunes"], - "restrictionsForceAssistantProfanityFilter": operationPayload["forceAssistantProfanityFilter"], - "restrictionsForceEncryptedBackup": operationPayload["forceEncryptedBackup"], - "restrictionsForceITunesStorePasswordEntry": operationPayload["forceITunesStorePasswordEntry"], - "restrictionsForceLimitAdTracking": operationPayload["forceLimitAdTracking"], - "restrictionsForceAirPlayOutgoingRequestsPairingPassword": operationPayload["forceAirPlayOutgoingRequestsPairingPassword"], - "restrictionsForceAirPlayIncomingRequestsPairingPassword": operationPayload["forceAirPlayIncomingRequestsPairingPassword"], - "restrictionsAllowManagedAppsCloudSync": operationPayload["allowManagedAppsCloudSync"], - "restrictionsAllowEraseContentAndSettings": operationPayload["allowEraseContentAndSettings"], - "restrictionsAllowSpotlightInternetResults": operationPayload["allowSpotlightInternetResults"], - "restrictionsAllowEnablingRestrictions": operationPayload["allowEnablingRestrictions"], - "restrictionsAllowActivityContinuation": operationPayload["allowActivityContinuation"], - "restrictionsAllowEnterpriseBookBackup": operationPayload["allowEnterpriseBookBackup"], - "restrictionsAllowEnterpriseBookMetadataSync": operationPayload["allowEnterpriseBookMetadataSync"], - "restrictionsAllowPodcasts": operationPayload["allowPodcasts"], - "restrictionsAllowDefinitionLookup": operationPayload["allowDefinitionLookup"], - "restrictionsAllowPredictiveKeyboard": operationPayload["allowPredictiveKeyboard"], - "restrictionsAllowAutoCorrection": operationPayload["allowAutoCorrection"], - "restrictionsAllowSpellCheck": operationPayload["allowSpellCheck"], - "restrictionsSafariAcceptCookies": operationPayload["safariAcceptCookies"], - "restrictionsAutonomousSingleAppModePermittedAppIDs": operationPayload["autonomousSingleAppModePermittedAppIDs"] - }; - break; - case iosOperationConstants["VPN_OPERATION_CODE"]: - var pptp = false; - var l2tp = false; - if (operationPayload["vpnType"] == "PPTP") { - pptp = true; - } else if (operationPayload["vpnType"] == "L2TP") { - l2tp = true; - } - - payload = { - "userDefinedName": operationPayload["userDefinedName"], - "overridePrimary": operationPayload["overridePrimary"], - "onDemandEnabled": operationPayload["onDemandEnabled"], - "onDemandMatchDomainsAlways": operationPayload["onDemandMatchDomainsAlways"], - "onDemandMatchDomainsNever": operationPayload["onDemandMatchDomainsNever"], - "onDemandMatchDomainsOnRetry": operationPayload["onDemandMatchDomainsOnRetry"], - "onDemandRules": operationPayload["onDemandRules"], - "vendorConfigs": operationPayload["vendorConfigs"], - "vpnType": operationPayload["vpnType"], - "pptpAuthName": pptp ? operationPayload.ppp["authName"] : "", - "pptpTokenCard": pptp ? operationPayload.ppp["tokenCard"] : "", - "pptpAuthPassword": pptp ? operationPayload.ppp["authPassword"] : "", - "pptpCommRemoteAddress": pptp ? operationPayload.ppp["commRemoteAddress"] : "", - "pptpRSASecureID": pptp ? operationPayload.ppp["RSASecureID"] : "", - "pptpCCPEnabled": pptp ? operationPayload.ppp["CCPEnabled"] : "", - "pptpCCPMPPE40Enabled": pptp ? operationPayload.ppp["CCPMPPE40Enabled"] : "", - "pptpCCPMPPE128Enabled": pptp ? operationPayload.ppp["CCPMPPE128Enabled"] : "", - "l2tpAuthName": l2tp ? operationPayload.ppp["authName"] : "", - "l2tpTokenCard": l2tp ? operationPayload.ppp["tokenCard"] : "", - "l2tpAuthPassword": l2tp ? operationPayload.ppp["authPassword"] : "", - "l2tpCommRemoteAddress": l2tp ? operationPayload.ppp["commRemoteAddress"] : "", - "l2tpRSASecureID": l2tp ? operationPayload.ppp["RSASecureID"] : "", - "ipsecRemoteAddress": operationPayload.ipSec["remoteAddress"], - "ipsecAuthenticationMethod": operationPayload.ipSec["authenticationMethod"], - "ipsecLocalIdentifier": operationPayload.ipSec["localIdentifier"], - "ipsecSharedSecret": operationPayload.ipSec["sharedSecret"], - "ipsecPayloadCertificateUUID": operationPayload.ipSec["payloadCertificateUUID"], - "ipsecXAuthEnabled": operationPayload.ipSec["XAuthEnabled"], - "ipsecXAuthName": operationPayload.ipSec["XAuthName"], - "ipsecPromptForVPNPIN": operationPayload.ipSec["promptForVPNPIN"], - "ikev2RemoteAddress": operationPayload.ikEv2["remoteAddress"], - "ikev2LocalIdentifier": operationPayload.ikEv2["localIdentifier"], - "ikev2RemoteIdentifier": operationPayload.ikEv2["remoteIdentifier"], - "ikev2AuthenticationMethod": operationPayload.ikEv2["authenticationMethod"], - "ikev2SharedSecret": operationPayload.ikEv2["sharedSecret"], - "ikev2PayloadCertificateUUID": operationPayload.ikEv2["payloadCertificateUUID"], - "ikev2ExtendedAuthEnabled": operationPayload.ikEv2["extendedAuthEnabled"], - "ikev2AuthName": operationPayload.ikEv2["authName"], - "ikev2AuthPassword": operationPayload.ikEv2["authPassword"], - "ikev2DeadPeerDetectionInterval": operationPayload.ikEv2["deadPeerDetectionInterval"], - "ikev2ServerCertificateIssuerCommonName": operationPayload.ikEv2["serverCertificateIssuerCommonName"], - "ikev2ServerCertificateCommonName": operationPayload.ikEv2["serverCertificateCommonName"] - }; - break; - case iosOperationConstants["PER_APP_VPN_OPERATION_CODE"]: - payload = { - "operation": { - "VPNUUID": operationPayload["PER-APP-VPNUUID"], - "safariDomains": operationPayload["safariDomains"], - "onDemandMatchAppEnabled": operationPayload["onDemandMatchAppEnabled"] - } - }; - break; - case iosOperationConstants["APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE"]: - payload = { - "operation": { - "appLayerVPNMappings": operationPayload["appLayerVPNMappings"] - } - }; - break; - case iosOperationConstants["WIFI_OPERATION_CODE"]: - payload = { - "wifiHiddenNetwork": operationPayload["hiddenNetwork"], - "wifiSSID": operationPayload["SSID"], - "wifiAutoJoin": operationPayload["autoJoin"], - "wifiProxyType": operationPayload["proxyType"], - "wifiEncryptionType": operationPayload["encryptionType"], - "wifiIsHotSpot": operationPayload["hotspot"], - "wifiDomainName": operationPayload["domainName"], - "wifiServiceProviderRoamingEnabled": operationPayload["serviceProviderRoamingEnabled"], - "wifiDisplayedOperatorName": operationPayload["displayedOperatorName"], - "wifiRoamingConsortiumOIs": operationPayload["roamingConsortiumOIs"], - "wifiPassword": operationPayload["password"], - "wifiPayloadCertUUID": operationPayload["payloadCertificateUUID"], - "wifiProxyServer": operationPayload["proxyServer"], - "wifiProxyPort": operationPayload["proxyPort"], - "wifiProxyUsername": operationPayload["proxyUsername"], - "wifiProxyPassword": operationPayload["proxyPassword"], - "wifiProxyPACURL": operationPayload["proxyPACURL"], - "wifiProxyPACFallbackAllowed": operationPayload["proxyPACFallbackAllowed"], - "wifiNAIRealmNames": operationPayload["nairealmNames"], - "wifiMCCAndMNCs": operationPayload["mccandMNCs"], - "wifiEAPUsername": operationPayload.clientConfiguration["username"], - "wifiAcceptedEAPTypes": operationPayload.clientConfiguration["acceptEAPTypes"], - "wifiEAPPassword": operationPayload.clientConfiguration["userPassword"], - "wifiEAPOneTimePassword": operationPayload.clientConfiguration["oneTimePassword"], - "wifiPayloadCertificateAnchorUUIDs": operationPayload.clientConfiguration["payloadCertificateAnchorUUID"], - "wifiEAPOuterIdentity": operationPayload.clientConfiguration["outerIdentity"], - "wifiTLSTrustedServerNames": operationPayload.clientConfiguration["tlstrustedServerNames"], - "wifiEAPTLSAllowTrustExceptions": operationPayload.clientConfiguration["tlsallowTrustExceptions"], - "wifiEAPTLSCertIsRequired": operationPayload.clientConfiguration["tlscertificateIsRequired"], - "wifiEAPTLSInnerAuthType": operationPayload.clientConfiguration["ttlsinnerAuthentication"], - "wifiEAPFastUsePAC": operationPayload.clientConfiguration["eapfastusePAC"], - "wifiEAPFastProvisionPAC": operationPayload.clientConfiguration["eapfastprovisionPAC"], - "wifiEAPFastProvisionPACAnonymously": operationPayload.clientConfiguration["eapfastprovisionPACAnonymously"], - "wifiEAPSIMNoOfRands": operationPayload.clientConfiguration["eapsimnumberOfRANDs"] - }; - break; - case iosOperationConstants["EMAIL_OPERATION_CODE"]: - payload = { - "emailAccountDescription": operationPayload["emailAccountDescription"], - "emailAccountName": operationPayload["emailAccountName"], - "emailAccountType": operationPayload["emailAccountType"], - "emailAddress": operationPayload["emailAddress"], - "emailIncomingMailServerAuthentication": operationPayload["incomingMailServerAuthentication"], - "emailIncomingMailServerHostname": operationPayload["incomingMailServerHostName"], - "emailIncomingMailServerPort": operationPayload["incomingMailServerPortNumber"], - "emailIncomingUseSSL": operationPayload["incomingMailServerUseSSL"], - "emailIncomingMailServerUsername": operationPayload["incomingMailServerUsername"], - "emailIncomingMailServerPassword": operationPayload["incomingPassword"], - "emailOutgoingMailServerPassword": operationPayload["outgoingPassword"], - "emailOutgoingPasswordSameAsIncomingPassword": operationPayload["outgoingPasswordSameAsIncomingPassword"], - "emailOutgoingMailServerAuthentication": operationPayload["outgoingMailServerAuthentication"], - "emailOutgoingMailServerHostname": operationPayload["outgoingMailServerHostName"], - "emailOutgoingMailServerPort": operationPayload["outgoingMailServerPortNumber"], - "emailOutgoingUseSSL": operationPayload["outgoingMailServerUseSSL"], - "emailOutgoingMailServerUsername": operationPayload["outgoingMailServerUsername"], - "emailPreventMove": operationPayload["preventMove"], - "emailPreventAppSheet": operationPayload["preventAppSheet"], - "emailDisableMailRecentsSyncing": operationPayload["disableMailRecentsSyncing"], - "emailIncomingMailServerIMAPPathPrefix": operationPayload["incomingMailServerIMAPPathPrefix"], - "emailSMIMEEnabled": operationPayload["smimeenabled"], - "emailSMIMESigningCertificateUUID": operationPayload["smimesigningCertificateUUID"], - "emailSMIMEEncryptionCertificateUUID": operationPayload["smimeencryptionCertificateUUID"], - "emailSMIMEEnablePerMessageSwitch": operationPayload["smimeenablePerMessageSwitch"] - }; - break; - case iosOperationConstants["AIRPLAY_OPERATION_CODE"]: - payload = { - "airplayDestinations": operationPayload["airPlayDestinations"], - "airplayCredentials": operationPayload["airPlayCredentials"] - }; - break; - case iosOperationConstants["LDAP_OPERATION_CODE"]: - payload = { - "ldapAccountDescription": operationPayload["accountDescription"], - "ldapAccountHostname": operationPayload["accountHostName"], - "ldapUseSSL": operationPayload["accountUseSSL"], - "ldapAccountUsername": operationPayload["accountUsername"], - "ldapAccountPassword": operationPayload["accountPassword"], - "ldapSearchSettings": operationPayload["ldapSearchSettings"] - }; - break; - case iosOperationConstants["CALENDAR_OPERATION_CODE"]: - payload = { - "calendarAccountDescription": operationPayload["accountDescription"], - "calendarAccountHostname": operationPayload["hostName"], - "calendarAccountUsername": operationPayload["username"], - "calendarAccountPassword": operationPayload["password"], - "calendarUseSSL": operationPayload["useSSL"], - "calendarAccountPort": operationPayload["port"], - "calendarPrincipalURL": operationPayload["principalURL"] - }; - break; - case iosOperationConstants["CALENDAR_SUBSCRIPTION_OPERATION_CODE"]: - payload = { - "calendarSubscriptionDescription": operationPayload["accountDescription"], - "calendarSubscriptionHostname": operationPayload["hostName"], - "calendarSubscriptionUsername": operationPayload["username"], - "calendarSubscriptionPassword": operationPayload["password"], - "calendarSubscriptionUseSSL": operationPayload["useSSL"] - }; - break; - case iosOperationConstants["APN_OPERATION_CODE"]: - payload = { - "apnConfigurations": operationPayload["apnConfigurations"] - }; - break; - case iosOperationConstants["CELLULAR_OPERATION_CODE"]: - payload = { - "cellularAttachAPNName": operationPayload["attachAPNName"], - "cellularAuthenticationType": operationPayload["authenticationType"], - "cellularUsername": operationPayload["username"], - "cellularPassword": operationPayload["password"], - "cellularAPNConfigurations": operationPayload["apnConfigurations"] - }; - break; - } - return payload; - }; - - privateMethods.generateIOSOperationPayload = function (operationCode, operationData, deviceList) { - var payload; - var operationType; - switch (operationCode) { - case iosOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "forcePIN": operationData["passcodePolicyForcePIN"], - "allowSimple": operationData["passcodePolicyAllowSimple"], - "requireAlphanumeric": operationData["passcodePolicyRequireAlphanumeric"], - "minLength": operationData["passcodePolicyMinLength"], - "minComplexChars": operationData["passcodePolicyMinComplexChars"], - "maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"], - "pinHistory": operationData["passcodePolicyPasscodeHistory"], - "maxInactivity": operationData["passcodePolicyMaxAutoLock"], - "maxGracePeriod": operationData["passcodePolicyGracePeriod"], - "maxFailedAttempts": operationData["passcodePolicyMaxFailedAttempts"] - } - }; - break; - case iosOperationConstants["WIFI_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - if (operationData["wifiProxyPort"] == "") { - operationData["wifiProxyPort"] = -1; - } - payload = { - "operation": { - "SSID": operationData["wifiSSID"], - "hiddenNetwork": operationData["wifiHiddenNetwork"], - "autoJoin": operationData["wifiAutoJoin"], - "proxyType": operationData["wifiProxyType"], - "encryptionType": operationData["wifiEncryptionType"], - "hotspot": operationData["wifiIsHotSpot"], - "domainName": operationData["wifiDomainName"], - "serviceProviderRoamingEnabled": operationData["wifiServiceProviderRoamingEnabled"], - "displayedOperatorName": operationData["wifiDisplayedOperatorName"], - "roamingConsortiumOIs": operationData["wifiRoamingConsortiumOIs"], - "password": operationData["wifiPassword"], - "clientConfiguration": { - "username": operationData["wifiEAPUsername"], - "acceptEAPTypes": operationData["wifiAcceptedEAPTypes"], - "userPassword": operationData["wifiEAPPassword"], - "oneTimePassword": operationData["wifiEAPOneTimePassword"], - "payloadCertificateAnchorUUID": operationData["wifiPayloadCertificateAnchorUUIDs"], - "outerIdentity": operationData["wifiEAPOuterIdentity"], - "tlstrustedServerNames": operationData["wifiTLSTrustedServerNames"], - "tlsallowTrustExceptions": operationData["wifiEAPTLSAllowTrustExceptions"], - "tlscertificateIsRequired": operationData["wifiEAPTLSCertIsRequired"], - "ttlsinnerAuthentication": operationData["wifiEAPTLSInnerAuthType"], - "eapfastusePAC": operationData["wifiEAPFastUsePAC"], - "eapfastprovisionPAC": operationData["wifiEAPFastProvisionPAC"], - "eapfastprovisionPACAnonymously": operationData["wifiEAPFastProvisionPACAnonymously"], - "eapsimnumberOfRANDs": operationData["wifiEAPSIMNoOfRands"] - }, - "payloadCertificateUUID": operationData["wifiPayloadCertUUID"], - "proxyServer": operationData["wifiProxyServer"], - "proxyPort": operationData["wifiProxyPort"], - "proxyUsername": operationData["wifiProxyUsername"], - "proxyPassword": operationData["wifiProxyPassword"], - "proxyPACURL": operationData["wifiProxyPACURL"], - "proxyPACFallbackAllowed": operationData["wifiProxyPACFallbackAllowed"], - "nairealmNames": operationData["wifiNAIRealmNames"], - "mccandMNCs": operationData["wifiMCCAndMNCs"] - } - }; - break; - case iosOperationConstants["VPN_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - var ppp = {}; - var ipSec = {}; - var ikev2 = {}; - var pulseSecure = {}; - - if (operationData["vpnType"] == "PPTP") { - ppp = { - "authName": operationData["pptpAuthName"], - "tokenCard": operationData["pptpTokenCard"], - "authPassword": operationData["pptpAuthPassword"], - "commRemoteAddress": operationData["pptpCommRemoteAddress"], - "RSASecureID": operationData["pptpRSASecureID"], - "CCPEnabled": operationData["pptpCCPEnabled"], - "CCPMPPE40Enabled": operationData["pptpCCPMPPE40Enabled"], - "CCPMPPE128Enabled": operationData["pptpCCPMPPE128Enabled"] - }; - } else if (operationData["vpnType"] == "L2TP") { - ppp = { - "authName": operationData["l2tpAuthName"], - "tokenCard": operationData["l2tpTokenCard"], - "authPassword": operationData["l2tpAuthPassword"], - "commRemoteAddress": operationData["l2tpCommRemoteAddress"], - "RSASecureID": operationData["l2tpRSASecureID"] - }; - } else if (operationData["vpnType"] == "IPSec") { - ipSec = { - "remoteAddress": operationData["ipsecRemoteAddress"], - "authenticationMethod": operationData["ipsecAuthenticationMethod"], - "localIdentifier": operationData["ipsecLocalIdentifier"], - "sharedSecret": operationData["ipsecSharedSecret"], - "payloadCertificateUUID": operationData["ipsecPayloadCertificateUUID"], - "XAuthEnabled": operationData["ipsecXAuthEnabled"], - "XAuthName": operationData["ipsecXAuthName"], - "promptForVPNPIN": operationData["ipsecPromptForVPNPIN"] - }; - } else if (operationData["vpnType"] == "IKEv2") { - ikev2 = { - "remoteAddress": operationData["ikev2RemoteAddress"], - "localIdentifier": operationData["ikev2LocalIdentifier"], - "remoteIdentifier": operationData["ikev2RemoteIdentifier"], - "authenticationMethod": operationData["ikev2AuthenticationMethod"], - "sharedSecret": operationData["ikev2SharedSecret"], - "payloadCertificateUUID": operationData["ikev2PayloadCertificateUUID"], - "extendedAuthEnabled": operationData["ikev2ExtendedAuthEnabled"], - "authName": operationData["ikev2AuthName"], - "authPassword": operationData["ikev2AuthPassword"], - "deadPeerDetectionInterval": operationData["ikev2DeadPeerDetectionInterval"], - "serverCertificateIssuerCommonName": operationData["ikev2ServerCertificateIssuerCommonName"], - "serverCertificateCommonName": operationData["ikev2ServerCertificateCommonName"] - }; - } else if (operationData["vpnType"] == "PulseSecure") { - pulseSecure = { - "remoteAddress": operationData["pulsesecureRemoteAddress"], - "userName": operationData["pulsesecureName"], - "sharedSecret": operationData["pulsesecureSharedSecret"] - }; - } - - var domainsAlways = new Array(); - for (var i = 0; i < operationData["onDemandMatchDomainsAlways"].length; i++) { - domainsAlways.push(operationData["onDemandMatchDomainsAlways"][i].domain); - } - - var domainsNever = new Array(); - for (var i = 0; i < operationData["onDemandMatchDomainsNever"].length; i++) { - domainsNever.push(operationData["onDemandMatchDomainsNever"][i].domain); - } - - var domainsRetry = new Array(); - for (var i = 0; i < operationData["onDemandMatchDomainsOnRetry"].length; i++) { - domainsRetry.push(operationData["onDemandMatchDomainsOnRetry"][i].domain); - } - - payload = { - "operation": { - "userDefinedName": operationData["userDefinedName"], - "overridePrimary": operationData["overridePrimary"], - "onDemandEnabled": operationData["onDemandEnabled"], - "onDemandMatchDomainsAlways": domainsAlways, - "onDemandMatchDomainsNever": domainsNever, - "onDemandMatchDomainsOnRetry": domainsRetry, - "onDemandRules": operationData["onDemandRules"], - "vendorConfigs": operationData["vendorConfigs"], - "vpnType": operationData["vpnType"], - "ppp": ppp, - "ipSec": ipSec, - "ikEv2": ikev2, - "pulseSecure": pulseSecure - } - }; - break; - case iosOperationConstants["PER_APP_VPN_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - var domains = new Array(); - for (var i = 0; i < operationData["safariDomains"].length; i++) { - domains.push(operationData["safariDomains"][i].domain); - } - payload = { - "operation": { - "VPNUUID": operationData["VPNUUID"], - "safariDomains": domains, - "onDemandMatchAppEnabled": operationData["onDemandMatchAppEnabled"] - } - }; - break; - case iosOperationConstants["APP_TO_PER_APP_VPN_MAPPING_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "appLayerVPNMappings": operationData["appLayerVPNMappings"] - } - }; - break; - case iosOperationConstants["RESTRICTIONS_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "allowAccountModification": operationData["restrictionsAllowAccountModification"], - "allowAddingGameCenterFriends": operationData["restrictionsAllowAddingGameCenterFriends"], - "allowAirDrop": operationData["restrictionsAllowAirDrop"], - "allowAppCellularDataModification": operationData["restrictionsAllowAppCellularDataModification"], - "allowAppInstallation": operationData["restrictionsAllowAppInstallation"], - "allowAppRemoval": operationData["restrictionsAllowAppRemoval"], - "allowAssistant": operationData["restrictionsAllowAssistant"], - "allowAssistantUserGeneratedContent": operationData["restrictionsAllowAssistantUserGeneratedContent"], - "allowAssistantWhileLocked": operationData["restrictionsAllowAssistantWhileLocked"], - "allowBookstore": operationData["restrictionsAllowBookstore"], - "allowBookstoreErotica": operationData["restrictionsAllowBookstoreErotica"], - "allowCamera": operationData["restrictionsAllowCamera"], - "allowChat": operationData["restrictionsAllowChat"], - "allowCloudBackup": operationData["restrictionsAllowCloudBackup"], - "allowCloudDocumentSync": operationData["restrictionsAllowCloudDocumentSync"], - "allowCloudKeychainSync": operationData["restrictionsAllowCloudKeychainSync"], - "allowDiagnosticSubmission": operationData["restrictionsAllowDiagnosticSubmission"], - "allowExplicitContent": operationData["restrictionsAllowExplicitContent"], - "allowFindMyFriendsModification": operationData["restrictionsAllowFindMyFriendsModification"], - "allowFingerprintForUnlock": operationData["restrictionsAllowFingerprintForUnlock"], - "allowGameCenter": operationData["restrictionsAllowGameCenter"], - "allowGlobalBackgroundFetchWhenRoaming": operationData["restrictionsAllowGlobalBackgroundFetchWhenRoaming"], - "allowInAppPurchases": operationData["restrictionsAllowInAppPurchases"], - "allowLockScreenControlCenter": operationData["restrictionsAllowLockScreenControlCenter"], - "allowHostPairing": operationData["restrictionsAllowHostPairing"], - "allowLockScreenNotificationsView": operationData["restrictionsAllowLockScreenNotificationsView"], - "allowLockScreenTodayView": operationData["restrictionsAllowLockScreenTodayView"], - "allowMultiplayerGaming": operationData["restrictionsAllowMultiplayerGaming"], - "allowOpenFromManagedToUnmanaged": operationData["restrictionsAllowOpenFromManagedToUnmanaged"], - "allowOpenFromUnmanagedToManaged": operationData["restrictionsAllowOpenFromUnmanagedToManaged"], - "allowOTAPKIUpdates": operationData["restrictionsAllowOTAPKIUpdates"], - "allowPassbookWhileLocked": operationData["restrictionsAllowPassbookWhileLocked"], - "allowPhotoStream": operationData["restrictionsAllowPhotoStream"], - "allowSafari": operationData["restrictionsAllowSafari"], - "safariAllowAutoFill": operationData["restrictionsSafariAllowAutoFill"], - "safariForceFraudWarning": operationData["restrictionsSafariForceFraudWarning"], - "safariAllowJavaScript": operationData["restrictionsSafariAllowJavaScript"], - "safariAllowPopups": operationData["restrictionsSafariAllowPopups"], - "allowScreenShot": operationData["restrictionsAllowScreenShot"], - "allowSharedStream": operationData["restrictionsAllowSharedStream"], - "allowUIConfigurationProfileInstallation": operationData["restrictionsAllowUIConfigurationProfileInstallation"], - "allowUntrustedTLSPrompt": operationData["restrictionsAllowUntrustedTLSPrompt"], - "allowVideoConferencing": operationData["restrictionsAllowVideoConferencing"], - "allowVoiceDialing": operationData["restrictionsAllowVoiceDialing"], - "allowYouTube": operationData["restrictionsAllowYouTube"], - "allowiTunes": operationData["restrictionsAllowITunes"], - "forceAssistantProfanityFilter": operationData["restrictionsForceAssistantProfanityFilter"], - "forceEncryptedBackup": operationData["restrictionsForceEncryptedBackup"], - "forceITunesStorePasswordEntry": operationData["restrictionsForceITunesStorePasswordEntry"], - "forceLimitAdTracking": operationData["restrictionsForceLimitAdTracking"], - "forceAirPlayOutgoingRequestsPairingPassword": operationData["restrictionsForceAirPlayOutgoingRequestsPairingPassword"], - "forceAirPlayIncomingRequestsPairingPassword": operationData["restrictionsForceAirPlayIncomingRequestsPairingPassword"], - "allowManagedAppsCloudSync": operationData["restrictionsAllowManagedAppsCloudSync"], - "allowEraseContentAndSettings": operationData["restrictionsAllowEraseContentAndSettings"], - "allowSpotlightInternetResults": operationData["restrictionsAllowSpotlightInternetResults"], - "allowEnablingRestrictions": operationData["restrictionsAllowEnablingRestrictions"], - "allowActivityContinuation": operationData["restrictionsAllowActivityContinuation"], - "allowEnterpriseBookBackup": operationData["restrictionsAllowEnterpriseBookBackup"], - "allowEnterpriseBookMetadataSync": operationData["restrictionsAllowEnterpriseBookMetadataSync"], - "allowPodcasts": operationData["restrictionsAllowPodcasts"], - "allowDefinitionLookup": operationData["restrictionsAllowDefinitionLookup"], - "allowPredictiveKeyboard": operationData["restrictionsAllowPredictiveKeyboard"], - "allowAutoCorrection": operationData["restrictionsAllowAutoCorrection"], - "allowSpellCheck": operationData["restrictionsAllowSpellCheck"], - "safariAcceptCookies": operationData["restrictionsSafariAcceptCookies"], - "autonomousSingleAppModePermittedAppIDs": operationData["restrictionsAutonomousSingleAppModePermittedAppIDs"] - } - }; - break; - case iosOperationConstants["EMAIL_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "emailAccountDescription": operationData["emailAccountDescription"], - "emailAccountName": operationData["emailAccountName"], - "emailAccountType": operationData["emailAccountType"], - "emailAddress": operationData["emailAddress"], - "incomingMailServerAuthentication": operationData["emailIncomingMailServerAuthentication"], - "incomingMailServerHostName": operationData["emailIncomingMailServerHostname"], - "incomingMailServerPortNumber": operationData["emailIncomingMailServerPort"], - "incomingMailServerUseSSL": operationData["emailIncomingUseSSL"], - "incomingMailServerUsername": operationData["emailIncomingMailServerUsername"], - "incomingPassword": operationData["emailIncomingMailServerPassword"], - "outgoingPassword": operationData["emailOutgoingMailServerPassword"], - "outgoingPasswordSameAsIncomingPassword": operationData["emailOutgoingPasswordSameAsIncomingPassword"], - "outgoingMailServerAuthentication": operationData["emailOutgoingMailServerAuthentication"], - "outgoingMailServerHostName": operationData["emailOutgoingMailServerHostname"], - "outgoingMailServerPortNumber": operationData["emailOutgoingMailServerPort"], - "outgoingMailServerUseSSL": operationData["emailOutgoingUseSSL"], - "outgoingMailServerUsername": operationData["emailOutgoingMailServerUsername"], - "preventMove": operationData["emailPreventMove"], - "preventAppSheet": operationData["emailPreventAppSheet"], - "disableMailRecentsSyncing": operationData["emailDisableMailRecentsSyncing"], - "incomingMailServerIMAPPathPrefix": operationData["emailIncomingMailServerIMAPPathPrefix"], - "smimeenabled": operationData["emailSMIMEEnabled"], - "smimesigningCertificateUUID": operationData["emailSMIMESigningCertificateUUID"], - "smimeencryptionCertificateUUID": operationData["emailSMIMEEncryptionCertificateUUID"], - "smimeenablePerMessageSwitch": operationData["emailSMIMEEnablePerMessageSwitch"] - } - }; - break; - case iosOperationConstants["AIRPLAY_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "airPlayDestinations": operationData["airplayDestinations"], - "airPlayCredentials": operationData["airplayCredentials"] - } - }; - break; - case iosOperationConstants["LDAP_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "accountDescription": operationData["ldapAccountDescription"], - "accountHostName": operationData["ldapAccountHostname"], - "accountUseSSL": operationData["ldapUseSSL"], - "accountUsername": operationData["ldapAccountUsername"], - "accountPassword": operationData["ldapAccountPassword"], - "ldapSearchSettings": operationData["ldapSearchSettings"] - } - }; - break; - case iosOperationConstants["CALENDAR_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "accountDescription": operationData["calendarAccountDescription"], - "hostName": operationData["calendarAccountHostname"], - "username": operationData["calendarAccountUsername"], - "password": operationData["calendarAccountPassword"], - "useSSL": operationData["calendarUseSSL"], - "port": operationData["calendarAccountPort"], - "principalURL": operationData["calendarPrincipalURL"] - } - }; - break; - case iosOperationConstants["CALENDAR_SUBSCRIPTION_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "accountDescription": operationData["calendarSubscriptionDescription"], - "hostName": operationData["calendarSubscriptionHostname"], - "username": operationData["calendarSubscriptionUsername"], - "password": operationData["calendarSubscriptionPassword"], - "useSSL": operationData["calendarSubscriptionUseSSL"] - } - }; - break; - case iosOperationConstants["APN_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "apnConfigurations": operationData["apnConfigurations"] - } - }; - break; - case iosOperationConstants["DOMAIN_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "emailDomains": operationData["emailDomains"], - "webDomains": operationData["webDomains"] - } - }; - break; - case - iosOperationConstants["CELLULAR_OPERATION_CODE"] - : - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "attachAPNName": operationData["cellularAttachAPNName"], - "authenticationType": operationData["cellularAuthenticationType"], - "username": operationData["cellularUsername"], - "password": operationData["cellularPassword"], - "apnConfigurations": operationData["cellularAPNConfigurations"] - } - }; - break; - case - iosOperationConstants["NOTIFICATION_OPERATION_CODE"] - : - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "messageTitle": operationData["messageTitle"], - "messageText": operationData["messageText"] - } - }; - break; - default: - // If the operation is neither of above, it is a command operation - operationType = operationTypeConstants["COMMAND"]; - // Operation payload of a command operation is simply an array of device IDs - payload = deviceList; - } - - if (operationType == operationTypeConstants["PROFILE"] && deviceList) { - payload["deviceIDs"] = deviceList; - } - return payload; - } - ; - - /** - * Convert the android platform specific code to the generic payload. - * TODO: think of the possibility to follow a pattern to the key name (namespace?) - * @param operationCode - * @param operationPayload - * @returns {{}} - */ - privateMethods.generateGenericPayloadFromAndroidPayload = function (operationCode, operationPayload) { - var payload = {}; - operationPayload = JSON.parse(operationPayload); - switch (operationCode) { - case androidOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - payload = { - "passcodePolicyAllowSimple": operationPayload["allowSimple"], - "passcodePolicyRequireAlphanumeric": operationPayload["requireAlphanumeric"], - "passcodePolicyMinLength": operationPayload["minLength"], - "passcodePolicyMinComplexChars": operationPayload["minComplexChars"], - "passcodePolicyMaxPasscodeAgeInDays": operationPayload["maxPINAgeInDays"], - "passcodePolicyPasscodeHistory": operationPayload["pinHistory"], - "passcodePolicyMaxFailedAttempts": operationPayload["maxFailedAttempts"] - }; - break; - case androidOperationConstants["CAMERA_OPERATION_CODE"]: - payload = operationPayload; - break; - case androidOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"]: - payload = { - "encryptStorageEnabled": operationPayload["encrypted"] - }; - break; - case androidOperationConstants["WORK_PROFILE_CODE"]: - payload = { - "workProfilePolicyProfileName": operationPayload["profileName"], - "workProfilePolicyEnableSystemApps": operationPayload["enableSystemApps"], - "workProfilePolicyHideSystemApps": operationPayload["hideSystemApps"], - "workProfilePolicyUnhideSystemApps": operationPayload["unhideSystemApps"], - "workProfilePolicyEnablePlaystoreApps": operationPayload["enablePlaystoreApps"] - }; - break; - case androidOperationConstants["WIFI_OPERATION_CODE"]: - payload = { - "wifiSSID": operationPayload["ssid"], - "wifiPassword": operationPayload["password"], - "wifiType": operationPayload["type"], - "wifiEAP": operationPayload["eap"], - "wifiPhase2": operationPayload["phase2"], - "wifiProvisioning": operationPayload["provisioning"], - "wifiIdentity": operationPayload["identity"], - "wifiAnoIdentity": operationPayload["anonymousIdentity"], - "wifiCaCert": operationPayload["cacert"], - "wifiCaCertName": operationPayload["cacertName"] - }; - break; - case androidOperationConstants["VPN_OPERATION_CODE"]: - payload = { - "serverAddress": operationPayload["serverAddress"], - "serverPort": operationPayload["serverPort"], - "sharedSecret": operationPayload["sharedSecret"], - "dnsServer": operationPayload["dnsServer"] - }; - break; - case androidOperationConstants["APPLICATION_OPERATION_CODE"]: - payload = { - "restrictionType": operationPayload["restriction-type"], - "restrictedApplications": operationPayload["restricted-applications"] - }; - break; - case androidOperationConstants["SYSTEM_UPDATE_POLICY_CODE"]: - if (operationPayload["type"] != "window") { - payload = { - "cosuSystemUpdatePolicyType": operationPayload["type"] - }; - } else { - payload = { - "cosuSystemUpdatePolicyType": operationPayload["type"], - "cosuSystemUpdatePolicyWindowStartTime": operationPayload["startTime"], - "cosuSystemUpdatePolicyWindowEndTime": operationPayload["endTime"] - }; - } - break; - case androidOperationConstants["KIOSK_APPS_CODE"]: - payload = { - "cosuWhitelistedApplications": operationPayload["whitelistedApplications"] - }; - break; - } - return payload; - }; - - privateMethods.generateAndroidOperationPayload = function (operationCode, operationData, deviceList) { - var payload; - var operationType; - switch (operationCode) { - case androidOperationConstants["CAMERA_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "CAMERA": operationData["cameraEnabled"], - "DISALLOW_ADJUST_VOLUME": operationData["disallowAdjustVolumeEnabled"], - "DISALLOW_CONFIG_BLUETOOTH": operationData["disallowConfigBluetooth"], - "DISALLOW_CONFIG_CELL_BROADCASTS": operationData["disallowConfigCellBroadcasts"], - "DISALLOW_CONFIG_CREDENTIALS": operationData["disallowConfigCredentials"], - "DISALLOW_CONFIG_MOBILE_NETWORKS": operationData["disallowConfigMobileNetworks"], - "DISALLOW_CONFIG_TETHERING": operationData["disallowConfigTethering"], - "DISALLOW_CONFIG_VPN": operationData["disallowConfigVpn"], - "DISALLOW_CONFIG_WIFI": operationData["disallowConfigWifi"], - "DISALLOW_APPS_CONTROL": operationData["disallowAppControl"], - "DISALLOW_CREATE_WINDOWS": operationData["disallowCreateWindows"], - "DISALLOW_CROSS_PROFILE_COPY_PASTE": operationData["disallowCrossProfileCopyPaste"], - "DISALLOW_DEBUGGING_FEATURES": operationData["disallowDebugging"], - "DISALLOW_FACTORY_RESET": operationData["disallowFactoryReset"], - "DISALLOW_ADD_USER": operationData["disallowAddUser"], - "DISALLOW_INSTALL_APPS": operationData["disallowInstallApps"], - "DISALLOW_INSTALL_UNKNOWN_SOURCES": operationData["disallowInstallUnknownSources"], - "DISALLOW_MODIFY_ACCOUNTS": operationData["disallowModifyAccounts"], - "DISALLOW_MOUNT_PHYSICAL_MEDIA": operationData["disallowMountPhysicalMedia"], - "DISALLOW_NETWORK_RESET": operationData["disallowNetworkReset"], - "DISALLOW_OUTGOING_BEAM": operationData["disallowOutgoingBeam"], - "DISALLOW_OUTGOING_CALLS": operationData["disallowOutgoingCalls"], - "DISALLOW_REMOVE_USER": operationData["disallowRemoveUser"], - "DISALLOW_SAFE_BOOT": operationData["disallowSafeBoot"], - "DISALLOW_SHARE_LOCATION": operationData["disallowLocationSharing"], - "DISALLOW_SMS": operationData["disallowSMS"], - "DISALLOW_UNINSTALL_APPS": operationData["disallowUninstallApps"], - "DISALLOW_UNMUTE_MICROPHONE": operationData["disallowUnmuteMicrophone"], - "DISALLOW_USB_FILE_TRANSFER": operationData["disallowUSBFileTransfer"], - "ALLOW_PARENT_PROFILE_APP_LINKING": operationData["disallowParentProfileAppLinking"], - "ENSURE_VERIFY_APPS": operationData["ensureVerifyApps"], - "AUTO_TIME": operationData["enableAutoTime"], - "SET_SCREEN_CAPTURE_DISABLED": operationData["disableScreenCapture"], - "SET_STATUS_BAR_DISABLED": operationData["disableStatusBar"] - } - }; - break; - case androidOperationConstants["CHANGE_LOCK_CODE_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "lockCode": operationData["lockCode"] - } - }; - break; - case androidOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "encrypted": operationData["encryptStorageEnabled"] - } - }; - break; - case androidOperationConstants["NOTIFICATION_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - //"message" : operationData["message"] - "messageText": operationData["messageText"], - "messageTitle": operationData["messageTitle"] - } - }; - break; - case androidOperationConstants["UPGRADE_FIRMWARE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "schedule": operationData["schedule"], - "server": operationData["server"] - } - }; - break; - case androidOperationConstants["WIPE_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "pin": operationData["pin"] - } - }; - break; - case androidOperationConstants["WIFI_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "ssid": operationData["wifiSSID"], - "type": operationData["wifiType"], - "password": operationData["wifiPassword"], - "eap": operationData["wifiEAP"], - "phase2": operationData["wifiPhase2"], - "provisioning": operationData["wifiProvisioning"], - "identity": operationData["wifiIdentity"], - "anonymousIdentity": operationData["wifiAnoIdentity"], - "cacert": operationData["wifiCaCert"], - "cacertName": operationData["wifiCaCertName"] - } - }; - break; - case androidOperationConstants["VPN_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "serverAddress": operationData["serverAddress"], - "serverPort": operationData["serverPort"], - "sharedSecret": operationData["sharedSecret"], - "dnsServer": operationData["dnsServer"] - } - }; - break; - case androidOperationConstants["LOCK_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "message": operationData["lock-message"], - "isHardLockEnabled": operationData["hard-lock"] - } - }; - break; - case androidOperationConstants["WORK_PROFILE_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "profileName": operationData["workProfilePolicyProfileName"], - "enableSystemApps": operationData["workProfilePolicyEnableSystemApps"], - "hideSystemApps": operationData["workProfilePolicyHideSystemApps"], - "unhideSystemApps": operationData["workProfilePolicyUnhideSystemApps"], - "enablePlaystoreApps": operationData["workProfilePolicyEnablePlaystoreApps"] - } - }; - break; - case androidOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "allowSimple": operationData["passcodePolicyAllowSimple"], - "requireAlphanumeric": operationData["passcodePolicyRequireAlphanumeric"], - "minLength": operationData["passcodePolicyMinLength"], - "minComplexChars": operationData["passcodePolicyMinComplexChars"], - "maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"], - "pinHistory": operationData["passcodePolicyPasscodeHistory"], - "maxFailedAttempts": operationData["passcodePolicyMaxFailedAttempts"] - } - }; - break; - case androidOperationConstants["APPLICATION_OPERATION_CODE"]: - payload = { - "operation": { - "restriction-type": operationData["restrictionType"], - "restricted-applications": operationData["restrictedApplications"] - } - }; - break; - case androidOperationConstants["SYSTEM_UPDATE_POLICY_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - if (operationData["cosuSystemUpdatePolicyType"] != "window") { - payload = { - "operation": { - "type": operationData["cosuSystemUpdatePolicyType"] - } - }; - } else { - payload = { - "operation": { - "type": operationData["cosuSystemUpdatePolicyType"], - "startTime": operationData["cosuSystemUpdatePolicyWindowStartTime"], - "endTime": operationData["cosuSystemUpdatePolicyWindowEndTime"] - } - }; - } - break; - case androidOperationConstants["KIOSK_APPS_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "whitelistedApplications": operationData["cosuWhitelistedApplications"] - } - }; - break; - default: - // If the operation is neither of above, it is a command operation - operationType = operationTypeConstants["COMMAND"]; - // Operation payload of a command operation is simply an array of device IDs - payload = deviceList; - } - - if (operationType == operationTypeConstants["PROFILE"] && deviceList) { - payload["deviceIDs"] = deviceList; - } - - return payload; - }; - - publicMethods.getAndroidServiceEndpoint = function (operationCode) { - var featureMap = { - "WIFI": "configure-wifi", - "CAMERA": "control-camera", - "VPN": "configure-vpn", - "DEVICE_LOCK": "lock-devices", - "DEVICE_UNLOCK": "unlock-devices", - "DEVICE_LOCATION": "location", - "CLEAR_PASSWORD": "clear-password", - "APPLICATION_LIST": "get-application-list", - "DEVICE_RING": "ring", - "DEVICE_REBOOT": "reboot", - "UPGRADE_FIRMWARE": "upgrade-firmware", - "DEVICE_MUTE": "mute", - "NOTIFICATION": "send-notification", - "ENCRYPT_STORAGE": "encrypt-storage", - "CHANGE_LOCK_CODE": "change-lock-code", - "WEBCLIP": "set-webclip", - "INSTALL_APPLICATION": "install-application", - "UNINSTALL_APPLICATION": "uninstall-application", - "BLACKLIST_APPLICATIONS": "blacklist-applications", - "PASSCODE_POLICY": "set-password-policy", - "ENTERPRISE_WIPE": "enterprise-wipe", - "WIPE_DATA": "wipe" - }; - //return "/mdm-android-agent/operation/" + featureMap[operationCode]; - return "/api/device-mgt/android/v1.0/admin/devices/" + featureMap[operationCode]; - }; - /** * Convert the windows platform specific code to the generic payload. * TODO: think of the possibility to follow a pattern to the key name (namespace?) @@ -1236,28 +148,6 @@ var operationModule = function () { //return "/mdm-windows-agent/services/windows/operation/" + featureMap[operationCode]; return "/api/device-mgt/windows/v1.0/services/windows/admin/devices/" + featureMap[operationCode]; }; - /** - * Get the icon for the featureCode - * @param operationCode - * @returns icon class - */ - publicMethods.getAndroidIconForFeature = function (operationCode) { - var featureMap = { - "DEVICE_LOCK": "fw-lock", - "DEVICE_LOCATION": "fw-map-location", - "CLEAR_PASSWORD": "fw-clear", - "ENTERPRISE_WIPE": "fw-block", - "WIPE_DATA": "fw-delete", - "DEVICE_RING": "fw-dial-up", - "DEVICE_REBOOT": "fw-refresh", - "UPGRADE_FIRMWARE": "fw-hardware", - "DEVICE_MUTE": "fw-mute", - "NOTIFICATION": "fw-message", - "CHANGE_LOCK_CODE": "fw-security", - "DEVICE_UNLOCK": "fw-key" - }; - return featureMap[operationCode]; - }; /** * Get the icon for the featureCode @@ -1275,22 +165,6 @@ var operationModule = function () { return featureMap[operationCode]; }; - /** - * Get the icon for the featureCode - * @param operationCode - * @returns icon class - */ - publicMethods.getIOSIconForFeature = function (operationCode) { - var featureMap = { - "DEVICE_LOCK": "fw-lock", - "LOCATION": "fw-map-location", - "ENTERPRISE_WIPE": "fw-block", - "NOTIFICATION": "fw-message", - "RING": "fw-dial-up" - }; - return featureMap[operationCode]; - }; - /** * Filter a list by a data attribute. * @param prop @@ -1308,12 +182,11 @@ var operationModule = function () { /** * Method to generate Platform specific operation payload. * - * @param platformType Platform Type of the profile * @param operationCode Operation Codes to generate the profile from * @param deviceList Optional device list to include in payload body for operations * @returns {*} */ - publicMethods.generatePayload = function (platformType, operationCode, deviceList) { + publicMethods.generatePayload = function (operationCode, deviceList) { var payload; var operationData = {}; // capturing form input data designated by .operationDataKeys @@ -1430,47 +303,23 @@ var operationModule = function () { } } ); - - switch (platformType) { - case platformTypeConstants["ANDROID"]: - payload = privateMethods.generateAndroidOperationPayload(operationCode, operationData, deviceList); - break; - case platformTypeConstants["IOS"]: - payload = privateMethods.generateIOSOperationPayload(operationCode, operationData, deviceList); - break; - case platformTypeConstants["WINDOWS"]: - payload = privateMethods.generateWindowsOperationPayload(operationCode, operationData, deviceList); - break; - } + payload = privateMethods.generateWindowsOperationPayload(operationCode, operationData, deviceList); return payload; }; /** * Method to populate the Platform specific operation payload. * - * @param platformType Platform Type of the profile * @param operationCode Operation Codes to generate the profile from * @param operationPayload payload * @returns {*} */ - publicMethods.populateUI = function (platformType, operationCode, operationPayload) { - var uiPayload; - switch (platformType) { - case platformTypeConstants["ANDROID"]: - uiPayload = privateMethods.generateGenericPayloadFromAndroidPayload(operationCode, operationPayload); - break; - case platformTypeConstants["IOS"]: - uiPayload = privateMethods.generateGenericPayloadFromIOSPayload(operationCode, operationPayload); - break; - case platformTypeConstants["WINDOWS"]: - uiPayload = privateMethods.generateGenericPayloadFromWindowsPayload(operationCode, operationPayload); - break; - } + publicMethods.populateUI = function (operationCode, operationPayload) { + var uiPayload = privateMethods.generateGenericPayloadFromWindowsPayload(operationCode, operationPayload); // capturing form input data designated by .operationDataKeys $(".operation-data").filterByData("operation-code", operationCode).find(".operationDataKeys").each( function () { var operationDataObj = $(this); - //TODO :remove //operationDataObj.prop('disabled', true) var key = operationDataObj.data("key"); // retrieve corresponding input value associated with the key @@ -1612,36 +461,15 @@ var operationModule = function () { /** * generateProfile method is only used for policy-creation UIs. * - * @param platformType Platform Type of the profile * @param operationCodes Operation codes to generate the profile from * @returns {{}} */ - publicMethods.generateProfile = function (platformType, operationCodes) { + publicMethods.generateProfile = function (operationCodes) { var generatedProfile = {}; for (var i = 0; i < operationCodes.length; ++i) { var operationCode = operationCodes[i]; - var payload = publicMethods.generatePayload(platformType, operationCode, null); - - if (platformType == platformTypeConstants["ANDROID"] && - operationCodes[i] == androidOperationConstants["CAMERA_OPERATION_CODE"]) { - var operations = payload["operation"]; - for (var key in operations) { - operationCode = key; - var restriction = false; - if (operations[key]) { - restriction = true; - } - var payloadResult = { - "operation": { - "enabled": restriction - } - }; - generatedProfile[operationCode] = payloadResult["operation"]; - } - - } else { - generatedProfile[operationCode] = payload["operation"]; - } + var payload = publicMethods.generatePayload(operationCode, null); + generatedProfile[operationCode] = payload["operation"]; } return generatedProfile; }; @@ -1649,133 +477,21 @@ var operationModule = function () { /** * populateProfile method is used to populate the html ui with saved payload. * - * @param platformType Platform Type of the profile * @param payload List of profileFeatures * @returns [] configuredOperations array */ - publicMethods.populateProfile = function (platformType, payload) { + publicMethods.populateProfile = function (payload) { var i, configuredOperations = []; - var restrictions = {}; for (i = 0; i < payload.length; ++i) { var configuredFeature = payload[i]; var featureCode = configuredFeature["featureCode"]; var operationPayload = configuredFeature["content"]; - if (platformType == platformTypeConstants["ANDROID"]) { - var restriction = JSON.parse(operationPayload); - if (featureCode == androidOperationConstants["CAMERA_OPERATION_CODE"]) { - restrictions["cameraEnabled"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_ADJUST_VOLUME"]) { - restrictions["disallowAdjustVolumeEnabled"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_BLUETOOTH"]) { - restrictions["disallowConfigBluetooth"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_CELL_BROADCASTS"]) { - restrictions["disallowConfigCellBroadcasts"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_CREDENTIALS"]) { - restrictions["disallowConfigCredentials"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_MOBILE_NETWORKS"]) { - restrictions["disallowConfigMobileNetworks"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_TETHERING"]) { - restrictions["disallowConfigTethering"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_VPN"]) { - restrictions["disallowConfigVpn"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_WIFI"]) { - restrictions["disallowConfigWifi"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_APPS_CONTROL"]) { - restrictions["disallowAppControl"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CREATE_WINDOWS"]) { - restrictions["disallowCreateWindows"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_CROSS_PROFILE_COPY_PASTE"]) { - restrictions["disallowCrossProfileCopyPaste"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_DEBUGGING_FEATURES"]) { - restrictions["disallowDebugging"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_FACTORY_RESET"]) { - restrictions["disallowFactoryReset"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_ADD_USER"]) { - restrictions["disallowAddUser"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_INSTALL_APPS"]) { - restrictions["disallowInstallApps"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_INSTALL_UNKNOWN_SOURCES"]) { - restrictions["disallowInstallUnknownSources"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_MODIFY_ACCOUNTS"]) { - restrictions["disallowModifyAccounts"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_MOUNT_PHYSICAL_MEDIA"]) { - restrictions["disallowMountPhysicalMedia"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_NETWORK_RESET"]) { - restrictions["disallowNetworkReset"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_OUTGOING_BEAM"]) { - restrictions["disallowOutgoingBeam"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_OUTGOING_CALLS"]) { - restrictions["disallowOutgoingCalls"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_REMOVE_USER"]) { - restrictions["disallowRemoveUser"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_SAFE_BOOT"]) { - restrictions["disallowSafeBoot"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_SHARE_LOCATION"]) { - restrictions["disallowLocationSharing"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_SMS"]) { - restrictions["disallowSMS"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_UNINSTALL_APPS"]) { - restrictions["disallowUninstallApps"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_UNMUTE_MICROPHONE"]) { - restrictions["disallowUnmuteMicrophone"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["DISALLOW_USB_FILE_TRANSFER"]) { - restrictions["disallowUSBFileTransfer"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["ALLOW_PARENT_PROFILE_APP_LINKING"]) { - restrictions["disallowParentProfileAppLinking"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["ENSURE_VERIFY_APPS"]) { - restrictions["ensureVerifyApps"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["AUTO_TIME"]) { - restrictions["enableAutoTime"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["SET_SCREEN_CAPTURE_DISABLED"]) { - restrictions["disableScreenCapture"] = restriction["enabled"]; - continue; - } else if (featureCode == androidOperationConstants["SET_STATUS_BAR_DISABLED"]) { - restrictions["disableStatusBar"] = restriction["enabled"]; - continue; - } - } //push the feature-code to the configuration array configuredOperations.push(featureCode); - publicMethods.populateUI(platformType, featureCode, operationPayload); - } - if (typeof restrictions.cameraEnabled !== 'undefined') { - configuredOperations.push(androidOperationConstants["CAMERA_OPERATION_CODE"]); - publicMethods.populateUI(platformType, androidOperationConstants["CAMERA_OPERATION_CODE"], JSON.stringify(restrictions)); + publicMethods.populateUI(featureCode, operationPayload); } return configuredOperations; }; return publicMethods; -}(); +}(); \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/public/js/windows-policy-edit.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/public/js/windows-policy-edit.js index 573760c43..ec7ae0003 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/public/js/windows-policy-edit.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/public/js/windows-policy-edit.js @@ -16,6 +16,8 @@ * under the License. */ +var configuredOperations = []; + var windowsOperationConstants = { "PASSCODE_POLICY_OPERATION": "passcode-policy", "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", @@ -52,21 +54,60 @@ var updateGroupedInputVisibility = function (domElement) { * * This method will be invoked from the relevant cdmf unit when the edit page gets loaded. * - * @param configuredOperations selected configurations. + * @param profileFeatureList saved feature list */ -var polulateProfileOperations = function (configuredOperations) { +var polulateProfileOperations = function (profileFeatureList) { + var selectedOperations = windowsOperationModule.populateProfile(profileFeatureList); $(".wr-advance-operations li.grouped-input").each(function () { updateGroupedInputVisibility(this); }); - for (var i = 0; i < configuredOperations.length; ++i) { - var configuredOperation = configuredOperations[i]; - $(".operation-data").filterByData("operation-code", configuredOperation) + for (var i = 0; i < selectedOperations.length; ++i) { + var selectedOperation = selectedOperations[i]; + $(".operation-data").filterByData("operation-code", selectedOperation) .find(".panel-title .wr-input-control.switch input[type=checkbox]").each(function () { $(this).click(); }); } }; +/** + * Generates policy profile feature list which will be saved with the profile. + * + * This function will be invoked from the relevant cdmf unit at the time of policy creation. + * + * @returns {Array} profile payloads + */ +var generateProfileFeaturesList = function () { + var profilePayloads = []; + // traverses key by key in policy["profile"] + var key; + for (key in policy["profile"]) { + if (policy["profile"].hasOwnProperty(key)) { + if (key == windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]) { + policy["profile"][key].enablePassword = true; + } + profilePayloads.push({ + "featureCode": key, + "deviceType": policy["platform"], + "content": policy["profile"][key] + }); + } + } + return profilePayloads; +}; + +/** + * Generates policy profile object which will be saved with the profile. + * + * This function will be invoked from the relevant cdmf unit at the time of policy creation. + * + * @returns {object} generated profile. + */ +var generatePolicyProfile = function () { + return windowsOperationModule.generateProfile(configuredOperations); +}; + + /** * Checks if provided number is valid against a range. * @@ -256,33 +297,6 @@ var validatePolicyProfile = function () { return wizardIsToBeContinued; }; -/** - * Generates policy profile object which will be saved with the profile. - * - * This function will be invoked from the relevant cdmf unit at the time of policy creation. - * - * @returns {Array} profile payloads - */ -var generatePolicyProfile = function () { - var profilePayloads = []; - // traverses key by key in policy["profile"] - var key; - for (key in policy["profile"]) { - if (key == windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]) { - policy["profile"][key].enablePassword = true; - } - if (policy["profile"].hasOwnProperty(key)) { - profilePayloads.push({ - "featureCode": key, - "deviceType": policy["platform"], - "content": policy["profile"][key] - }); - } - } - - return profilePayloads; -}; - // Start of HTML embedded invoke methods var showAdvanceOperation = function (operation, button) { $(button).addClass('selected'); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/public/js/windows-policy-view.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/public/js/windows-policy-view.js index 0b39e4540..9280bec14 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/public/js/windows-policy-view.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/public/js/windows-policy-view.js @@ -16,8 +16,6 @@ * under the License. */ -var configuredOperations = []; - /** * Method to update the visibility (i.e. disabled or enabled view) * of grouped input according to the values @@ -47,9 +45,10 @@ var updateGroupedInputVisibility = function (domElement) { * * This method will be invoked from the relevant cdmf unit when the edit page gets loaded. * - * @param selectedConfigurations selected configurations. + * @param profileFeatureList selected configurations. */ -var polulateProfileOperations = function (selectedConfigurations) { +var polulateProfileOperations = function (profileFeatureList) { + var selectedConfigurations = windowsOperationModule.populateProfile(profileFeatureList); $(".wr-advance-operations li.grouped-input").each(function () { updateGroupedInputVisibility(this); }); @@ -168,208 +167,20 @@ var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneI }; // End of HTML embedded invoke methods - -// Start of functions related to grid-input-view - -/** - * Method to set count id to cloned elements. - * @param {object} addFormContainer - */ -var setId = function (addFormContainer) { - $(addFormContainer).find("[data-add-form-clone]").each(function (i) { - $(this).attr("id", $(this).attr("data-add-form-clone").slice(1) + "-" + (i + 1)); - if ($(this).find(".index").length > 0) { - $(this).find(".index").html(i + 1); - } - }); -}; - -/** - * Method to set count id to cloned elements. - * @param {object} addFormContainer - */ -var showHideHelpText = function (addFormContainer) { - var helpText = "[data-help-text=add-form]"; - if ($(addFormContainer).find("[data-add-form-clone]").length > 0) { - $(addFormContainer).find(helpText).hide(); - } else { - $(addFormContainer).find(helpText).show(); - } -}; - -/** - * This method will display appropriate fields based on wifi type - * @param {object} wifi type select object - */ -var changeAndroidWifiPolicy = function (select) { - slideDownPaneAgainstValueSet(select, 'control-wifi-password', ['wep', 'wpa', '802eap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-eap', ['802eap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-phase2', ['802eap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-identity', ['802eap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-anoidentity', ['802eap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-cacert', ['802eap']); -}; - -/** - * This method will display appropriate fields based on wifi EAP type - * @param {object} wifi eap select object - * @param {object} wifi type select object - */ -var changeAndroidWifiPolicyEAP = function (select, superSelect) { - slideDownPaneAgainstValueSet(select, 'control-wifi-password', ['peap', 'ttls', 'pwd', 'fast', 'leap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-phase2', ['peap', 'ttls', 'fast']); - slideDownPaneAgainstValueSet(select, 'control-wifi-provisioning', ['fast']); - slideDownPaneAgainstValueSet(select, 'control-wifi-identity', ['peap', 'tls', 'ttls', 'pwd', 'fast', 'leap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-anoidentity', ['peap', 'ttls']); - slideDownPaneAgainstValueSet(select, 'control-wifi-cacert', ['peap', 'tls', 'ttls']); - if (superSelect.value != '802eap') { - changeAndroidWifiPolicy(superSelect); - } -}; - $(document).ready(function () { - // Maintains an array of configured features of the profile var advanceOperations = ".wr-advance-operations"; $(advanceOperations).on("click", ".wr-input-control.switch", function (event) { - var operationCode = $(this).parents(".operation-data").data("operation-code"); var operation = $(this).parents(".operation-data").data("operation"); - var operationDataWrapper = $(this).data("target"); // prevents event bubbling by figuring out what element it's being called from. if (event.target.tagName == "INPUT") { var featureConfiguredIcon; if ($("input[type='checkbox']", this).is(":checked")) { - configuredOperations.push(operationCode); - // when a feature is enabled, if "zero-configured-features" msg is available, hide that. - var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg"; - if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) { - $(zeroConfiguredOperationsErrorMsg).addClass("hidden"); - } // add configured-state-icon to the feature featureConfiguredIcon = "#" + operation + "-configured"; if ($(featureConfiguredIcon).hasClass("hidden")) { $(featureConfiguredIcon).removeClass("hidden"); } - } else { - //splicing the array if operation is present. - var index = $.inArray(operationCode, configuredOperations); - if (index != -1) { - configuredOperations.splice(index, 1); - } - // when a feature is disabled, clearing all its current configured, error or success states - var subErrorMsgWrapper = "#" + operation + "-feature-error-msg"; - var subErrorIcon = "#" + operation + "-error"; - var subOkIcon = "#" + operation + "-ok"; - featureConfiguredIcon = "#" + operation + "-configured"; - - if (!$(subErrorMsgWrapper).hasClass("hidden")) { - $(subErrorMsgWrapper).addClass("hidden"); - } - if (!$(subErrorIcon).hasClass("hidden")) { - $(subErrorIcon).addClass("hidden"); - } - if (!$(subOkIcon).hasClass("hidden")) { - $(subOkIcon).addClass("hidden"); - } - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - // reinitializing input fields into the defaults - $(operationDataWrapper + " input").each( - function () { - if ($(this).is("input:text")) { - $(this).val($(this).data("default")); - } else if ($(this).is("input:password")) { - $(this).val(""); - } else if ($(this).is("input:checkbox")) { - $(this).prop("checked", $(this).data("default")); - // if this checkbox is the parent input of a grouped-input - if ($(this).hasClass("parent-input")) { - var groupedInput = $(this).parent().parent().parent(); - updateGroupedInputVisibility(groupedInput); - } - } - } - ); - // reinitializing select fields into the defaults - $(operationDataWrapper + " select").each( - function () { - var defaultOption = $(this).data("default"); - $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); - } - ); - // collapsing expanded-panes (upon the selection of html-select-options) if any - $(operationDataWrapper + " .expanded").each( - function () { - if ($(this).hasClass("expanded")) { - $(this).removeClass("expanded"); - } - $(this).slideUp(); - } - ); - // removing all entries of grid-input elements if exist - $(operationDataWrapper + " .grouped-array-input").each( - function () { - var gridInputs = $(this).find("[data-add-form-clone]"); - if (gridInputs.length > 0) { - gridInputs.remove(); - } - var helpTexts = $(this).find("[data-help-text=add-form]"); - if (helpTexts.length > 0) { - helpTexts.show(); - } - } - ); } } }); - - // adding support for cloning multiple profiles per feature with cloneable class definitions - $(advanceOperations).on("click", ".multi-view.add.enabled", function () { - // get a copy of .cloneable and create new .cloned div element - var cloned = "

    " + $(".cloneable", $(this).parent().parent()).html() + "
    "; - // append newly created .cloned div element to panel-body - $(this).parent().parent().append(cloned); - // enable remove action of newly cloned div element - $(".cloned", $(this).parent().parent()).each( - function () { - if ($(".multi-view.remove", this).hasClass("disabled")) { - $(".multi-view.remove", this).removeClass("disabled"); - } - if (!$(".multi-view.remove", this).hasClass("enabled")) { - $(".multi-view.remove", this).addClass("enabled"); - } - } - ); - }); - - $(advanceOperations).on("click", ".multi-view.remove.enabled", function () { - $(this).parent().remove(); - }); - - // enabling or disabling grouped-input based on the status of a parent check-box - $(advanceOperations).on("click", ".grouped-input", function () { - updateGroupedInputVisibility(this); - }); - - // add form entry click function for grid inputs - $(advanceOperations).on("click", "[data-click-event=add-form]", function () { - var addFormContainer = $("[data-add-form-container=" + $(this).attr("href") + "]"); - var clonedForm = $("[data-add-form=" + $(this).attr("href") + "]").clone().find("[data-add-form-element=clone]").attr("data-add-form-clone", $(this).attr("href")); - - // adding class .child-input to capture text-input-array-values - $("input, select", clonedForm).addClass("child-input"); - - $(addFormContainer).append(clonedForm); - setId(addFormContainer); - showHideHelpText(addFormContainer); - }); - - // remove form entry click function for grid inputs - $(advanceOperations).on("click", "[data-click-event=remove-form]", function () { - var addFormContainer = $("[data-add-form-container=" + $(this).attr("href") + "]"); - - $(this).closest("[data-add-form-element=clone]").remove(); - setId(addFormContainer); - showHideHelpText(addFormContainer); - }); }); \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/public/js/windows-policy-operations.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/public/js/windows-policy-operations.js index 3a149ee88..4f8c121d0 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/public/js/windows-policy-operations.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/public/js/windows-policy-operations.js @@ -16,6 +16,8 @@ * under the License. */ +var configuredOperations = []; + var windowsOperationConstants = { "PASSCODE_POLICY_OPERATION": "passcode-policy", "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", @@ -237,21 +239,21 @@ var validatePolicyProfile = function () { }; /** - * Generates policy profile object which will be saved with the profile. + * Generates policy profile feature list which will be saved with the profile. * * This function will be invoked from the relevant cdmf unit at the time of policy creation. * * @returns {Array} profile payloads */ -var generatePolicyProfile = function () { +var generateProfileFeaturesList = function () { var profilePayloads = []; // traverses key by key in policy["profile"] var key; for (key in policy["profile"]) { - if (key == windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]) { - policy["profile"][key].enablePassword = true; - } if (policy["profile"].hasOwnProperty(key)) { + if (key == windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]) { + policy["profile"][key].enablePassword = true; + } profilePayloads.push({ "featureCode": key, "deviceType": policy["platform"], @@ -259,10 +261,27 @@ var generatePolicyProfile = function () { }); } } - return profilePayloads; }; +/** + * Generates policy profile object which will be saved with the profile. + * + * This function will be invoked from the relevant cdmf unit at the time of policy creation. + * + * @returns {object} generated profile. + */ +var generatePolicyProfile = function () { + return windowsOperationModule.generateProfile(configuredOperations); +}; + +/** + * Resets policy profile configurations. + */ +var resetPolicyProfile = function () { + configuredOperations = []; +}; + // Start of HTML embedded invoke methods var showAdvanceOperation = function (operation, button) { $(button).addClass('selected'); @@ -272,37 +291,6 @@ var showAdvanceOperation = function (operation, button) { $(hiddenOperation + '[data-operation="' + operation + '"]').siblings().hide(); }; - -/** - * This method will display appropriate fields based on wifi type - * @param select - */ -var changeAndroidWifiPolicy = function (select) { - slideDownPaneAgainstValueSet(select, 'control-wifi-password', ['wep', 'wpa', '802eap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-eap', ['802eap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-phase2', ['802eap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-identity', ['802eap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-anoidentity', ['802eap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-cacert', ['802eap']); -}; - -/** - * This method will display appropriate fields based on wifi EAP type - * @param select - * @param superSelect - */ -var changeAndroidWifiPolicyEAP = function (select, superSelect) { - slideDownPaneAgainstValueSet(select, 'control-wifi-password', ['peap', 'ttls', 'pwd', 'fast', 'leap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-phase2', ['peap', 'ttls', 'fast']); - slideDownPaneAgainstValueSet(select, 'control-wifi-provisioning', ['fast']); - slideDownPaneAgainstValueSet(select, 'control-wifi-identity', ['peap', 'tls', 'ttls', 'pwd', 'fast', 'leap']); - slideDownPaneAgainstValueSet(select, 'control-wifi-anoidentity', ['peap', 'ttls']); - slideDownPaneAgainstValueSet(select, 'control-wifi-cacert', ['peap', 'tls', 'ttls']); - if (superSelect.value != '802eap') { - changeAndroidWifiPolicy(superSelect); - } -}; - /** * Method to slide down a provided pane upon provided value set. * diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json index ce3efe795..d02ddd740 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/conf/config.json @@ -34,7 +34,7 @@ } }, "androidAgentApp" : "android-agent.apk", - "windowsConfigRoot" : "%http.ip%/api/device-mgt/windows/v1.0/services/federated/bst/authentication", + "windowsConfigRoot" : "%http.ip%/api/device-mgt/windows/v1.0/federated/bst/authentication", "ssoConfiguration" : { "enabled" : false, "issuer" : "mdm", diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/business-controllers/device.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/business-controllers/device.js index 3dce168f4..c0c190384 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/business-controllers/device.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/business-controllers/device.js @@ -312,7 +312,7 @@ deviceModule = function () { var url; var license; if (deviceType == "windows") { - url = devicemgtProps["httpURL"] + "/api/device-mgt/windows/v1.0/services/configuration/license"; + url = devicemgtProps["httpURL"] + "/api/device-mgt/windows/v1.0/configuration/license"; } else if (deviceType == "ios") { url = devicemgtProps["httpsURL"] + "/ios-enrollment/license/"; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml index e705fd116..c1deb838b 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml @@ -22,7 +22,7 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java index 5a21c0539..365468f7c 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java @@ -20,14 +20,12 @@ package org.wso2.carbon.device.mgt.mobile.windows.impl; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; +import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.ProvisioningConfig; -import org.wso2.carbon.device.mgt.common.TaskOperation; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; -import java.util.List; - /** * This represents the Windows implementation of DeviceManagerService. */ @@ -43,7 +41,7 @@ public class WindowsDeviceManagementService implements DeviceManagementService { } @Override - public List getTasksForPlatform() { + public OperationMonitoringTaskConfig getOperationMonitoringConfig() { return null; } diff --git a/components/mobile-plugins/windows-plugin/pom.xml b/components/mobile-plugins/windows-plugin/pom.xml index 16df9a17a..70430a2ef 100644 --- a/components/mobile-plugins/windows-plugin/pom.xml +++ b/components/mobile-plugins/windows-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml index c866d08f5..e76e68af5 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.analytics.feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml index 19ebf3080..9c3d1447f 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.iot.device.statistics.dashboard.feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml index fe8068e15..6e1dd1a88 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/pom.xml b/features/analytics-feature/pom.xml index 8234d9271..e10fdd79f 100644 --- a/features/analytics-feature/pom.xml +++ b/features/analytics-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/pom.xml index 65bb5dabf..22ed32920 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/pom.xml index da44a8aea..0870ac1dc 100644 --- a/features/device-types-feature/androidsense-plugin-feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/pom.xml index bcef998a2..bb1f213a2 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/pom.xml index bb6c1b869..57a08374a 100644 --- a/features/device-types-feature/arduino-plugin-feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/pom.xml b/features/device-types-feature/pom.xml index 470e5b09d..a346bb164 100644 --- a/features/device-types-feature/pom.xml +++ b/features/device-types-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml 4.0.0 device-types-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT pom WSO2 Carbon - Device Management IoT Plugins Feature http://wso2.org diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/pom.xml index 3e82dcfb5..ab03d0b52 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml index c98646268..3c935f4cc 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/pom.xml index dbe4004d3..b8063aca7 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml index ff054d2e8..81fece6eb 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml index a7365f20c..33c697fda 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml @@ -47,10 +47,6 @@ io.github.openfeign feign-gson
    - - io.github.openfeign - feign-jaxrs - @@ -86,7 +82,7 @@ - org.wso2.carbon.core.server:4.4.9 + org.wso2.carbon.core.server:${carbon.kernel.version} diff --git a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml index 178555d78..48efc912c 100644 --- a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml org.wso2.carbon.appmgt.mdm.osgiconnector.feature pom - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT WSO2 Carbon - App management MDM OSGI Connector http://wso2.org This feature contains the core bundles required for APP management OSGI MDM connection @@ -36,7 +36,7 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.appmgt.mdm.osgiconnector - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT org.apache.ws.commons.axiom diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml index 6a7b7cd8d..2fffe5051 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.adapter.feature pom - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT WSO2 Carbon - Device Management Adapters Feature http://wso2.org This feature contains the adapter bundles required for IoT Server diff --git a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml index 09380ecf4..a421b01e7 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml @@ -14,20 +14,19 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + 4.0.0 org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml org.wso2.extension.siddhi.execution.json.feature pom - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT WSO2 Siddhi Execution Extension - Json Feature http://wso2.org This feature contains Siddhi extension feature for changing a json string to individual properties. diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml index 3df828060..dac6985eb 100644 --- a/features/extensions-feature/pom.xml +++ b/features/extensions-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml 4.0.0 extensions-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT pom WSO2 Carbon - Device Management Extensions http://wso2.org diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml index 97b167450..9185bf2e4 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins android-plugin-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.feature pom - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT WSO2 Carbon - Android Device Management Feature http://wso2.org This feature contains the core bundles required for Android Device Management diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml index 18608e54b..271dcd78b 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml @@ -315,6 +315,8 @@ + true + 60000 DEVICE_INFO diff --git a/features/mobile-plugins-feature/android-plugin-feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/pom.xml index c1d76dd6d..45e10e3a5 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml 4.0.0 android-plugin-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT pom WSO2 Carbon - Device Management Android Plugin Feature http://wso2.org diff --git a/features/mobile-plugins-feature/pom.xml b/features/mobile-plugins-feature/pom.xml index f3b78a39b..4bd6cf73f 100644 --- a/features/mobile-plugins-feature/pom.xml +++ b/features/mobile-plugins-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../../pom.xml 4.0.0 mobile-plugins-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT pom WSO2 Carbon - Device Management EMM Plugins Feature http://wso2.org diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml index ae5bf7cb6..1e8da2121 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins windows-plugin-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.feature pom - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT WSO2 Carbon - Windows Device Management Feature http://wso2.org This feature contains the core bundles required for Windows Device Management diff --git a/features/mobile-plugins-feature/windows-plugin-feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/pom.xml index f3b683182..9e3cddee0 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/windows-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT ../pom.xml 4.0.0 windows-plugin-feature - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT pom WSO2 Carbon - Device Management Windows Plugin Feature http://wso2.org diff --git a/pom.xml b/pom.xml index f6181f323..520eb0a09 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent pom - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT WSO2 Carbon - Device Management Plugins Parent http://wso2.org WSO2 Carbon - Device Management Plugins Parent @@ -417,11 +417,6 @@ org.wso2.carbon.device.mgt.input.adapter.xmpp ${carbon.devicemgt.plugins.version} - - com.jayway.jsonpath - json-path - ${jsonpath.version} - org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.iot.api @@ -1110,12 +1105,6 @@ org.wso2.carbon.user.mgt ${carbon.commons.version} - - junit - junit - test - ${junit.version} - com.jayway.jsonpath json-path @@ -1250,14 +1239,14 @@ 1.1.1 - 2.0.3-SNAPSHOT + 2.0.4-SNAPSHOT [2.0.0, 3.0.0) - 1.2.8-SNAPSHOT + 1.2.8 - 3.0.3-SNAPSHOT + 3.0.4-SNAPSHOT 4.4.8 @@ -1312,7 +1301,6 @@ 2.4 1.0.8 1.8 - 0.9.1 2.2