{{/zone}}
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.js
index b6ac6b5f8c..512edff658 100644
--- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.js
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.js
@@ -16,8 +16,8 @@
* under the License.
*/
-function onRequest() {
- // var log = new Log("mdm.unit.device.operation-bar");
+function onRequest(context) {
+ var log = new Log("mdm.unit.device.operation-bar");
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var viewModel = {};
var permissions = {};
@@ -93,10 +93,14 @@ function onRequest() {
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/lockreset")) {
+ 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/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js
index a3186092ac..93be0add70 100644
--- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js
@@ -31,6 +31,10 @@ var operations = '.wr-operations',
"ANDROID": "android",
"IOS": "ios",
"WINDOWS": "windows"
+ },
+ ownershipTypeConstants = {
+ "BYOD": "BYOD",
+ "COPE": "COPE"
};
/*
@@ -94,62 +98,79 @@ function getDevicesByTypes(deviceList) {
return deviceTypes;
}
-function unloadOperationBar() {
- $("#showOperationsBtn").addClass("hidden");
- $(".wr-operations").html("");
-}
+//function unloadOperationBar() {
+// $("#showOperationsBtn").addClass("hidden");
+// $(".wr-operations").html("");
+//}
-function loadOperationBar(deviceType) {
+function loadOperationBar(deviceType, ownership) {
var operationBar = $("#operations-bar");
var operationBarSrc = operationBar.attr("src");
- var platformType = deviceType;
- //var selectedDeviceID = deviceId;
+
$.template("operations-bar", operationBarSrc, function (template) {
- //var serviceURL = "/mdm-admin/features/" + platformType;
- var serviceURL = "/api/device-mgt/v1.0/devices/" + platformType + "/*/features";
- var successCallback = 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"]) {
- permittedOperations.push(totalFeatures[j]);
+ 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 &&
+ totalFeatures[j]["code"] == "DEVICE_UNLOCK") {
+ if (ownership == ownershipTypeConstants.COPE) {
+ 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);
- current.type = deviceType;
- break;
- case platformTypeConstants.WINDOWS:
- iconName = operationModule.getWindowsIconForFeature(current.code);
- break;
- case platformTypeConstants.IOS:
- iconName = operationModule.getIOSIconForFeature(current.code);
- break;
- }
+ 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;
+ }
- if (iconName) {
- current.icon = iconName;
return current;
- }
- });
+ });
- viewModel.features = permittedOperations;
- var content = template(viewModel);
- $(".wr-operations").html(content);
- };
- invokerUtil.get(serviceURL, successCallback, function (message) {
- $(".wr-operations").html(message);
- });
+ viewModel.features = permittedOperations;
+ var content = template(viewModel);
+ $(".wr-operations").html(content);
+ },
+ // error callback
+ function (message) {
+ $(".wr-operations").html(message);
+ });
});
}
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/templates/operations.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/templates/operations.hbs
index cd32216746..0b94ae0881 100644
--- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/templates/operations.hbs
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/templates/operations.hbs
@@ -107,14 +107,16 @@
{{#equal code "WIPE_DATA"}}
- {{#equal type "android"}}
- Enter PIN code (Optional - This is required only if the device type is BYOD).
-
-
-
-
-
+ {{#equal deviceType "android"}}
+ {{#equal ownership "BYOD"}}
+ Enter PIN code* of the device
+
+
+
+
+ {{/equal}}
{{/equal}}
{{/equal}}
{{#equal code "NOTIFICATION"}}
@@ -141,26 +143,28 @@
{{/equal}}
{{#equal code "DEVICE_LOCK"}}
- {{#equal type "android"}}
- Type your message to be shown in the lock screen (Optional).
-
-
-
-
-
-
+
+ {{/equal}}
+ Type your message to be shown in the lock screen
+
+
+
+
{{/equal}}
{{/equal}}
{{#equal code "UPGRADE_FIRMWARE"}}
- {{#equal type "android"}}
+ {{#equal deviceType "android"}}
Enter firmware upgrade scheduling information.
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/public/js/device-detail.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/public/js/device-detail.js
index f6e8ea0488..fbe1e7b9d3 100644
--- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/public/js/device-detail.js
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/public/js/device-detail.js
@@ -22,6 +22,7 @@ var InitiateViewOption = null;
var deviceId = $(".device-id");
var deviceIdentifier = deviceId.data("deviceid");
var deviceType = deviceId.data("type");
+ var ownership = deviceId.data("ownership");
var operationTable;
$(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) {
@@ -291,7 +292,7 @@ var InitiateViewOption = null;
$(document).ready(function () {
$(".device-detail-body").removeClass("hidden");
$("#loading-content").remove();
- loadOperationBar(deviceType);
+ loadOperationBar(deviceType, ownership);
loadOperationsLog(false);
loadApplicationsList();
loadPolicyCompliance();
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.hbs
index f835d62631..25ee6706e6 100644
--- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.hbs
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.hbs
@@ -5,7 +5,7 @@
{{#zone "content"}}
{{#if deviceFound}}
{{#if isAuthorized}}
-