diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.hbs index 0bf54e2c2..fbc3f2753 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.hbs @@ -19,15 +19,15 @@ {{unit "cdmf.unit.lib.qrcode"}} {{unit "mdm.unit.device.qr-modal"}} {{#zone "content"}} - {{#if permissions.LIST_DEVICES}} -
-
-
-
Devices
-
-
-
- Loading... + {{#if permissions.LIST_DEVICES}} +
+ - {{/if}} - {{# if permissions.LIST_POLICIES}} -
-
-
Policies
-
-
-
- Loading... +
+ {{/if}} + {{# if permissions.LIST_POLICIES}} +
+
+
Policies
+
+
+
+ Loading... @@ -78,19 +80,19 @@ {{/if}} -
- {{/if}} - {{# if permissions.LIST_USERS}} -
-
-
Users
-
-
-
- Loading... +
+ {{/if}} + {{# if permissions.LIST_USERS}} +
+
+
Users
+
+
+
+ Loading... @@ -111,19 +113,19 @@ {{/if}} -
- {{/if}} - {{# if permissions.LIST_ROLES}} -
-
-
Roles
-
-
-
- Loading... +
+ {{/if}} + {{# if permissions.LIST_ROLES}} +
+
+
Roles
+
+
+
+ Loading... @@ -144,12 +146,12 @@ {{/if}} -
- {{/if}} +
+ {{/if}} {{/zone}} {{#zone "bottomJs"}} {{js "js/dashboard.js"}} diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.js index a6c495532..e1480d31c 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.dashboard/dashboard.js @@ -29,6 +29,9 @@ function onRequest(context) { permissions.ADD_POLICY = userModule.isAuthorized("/permission/admin/device-mgt/policies/manage"); permissions.ADD_ROLE = userModule.isAuthorized("/permission/admin/device-mgt/roles/manage"); permissions.ADD_USER = userModule.isAuthorized("/permission/admin/device-mgt/users/manage"); + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/ios") | userModule.isAuthorized("/permission/admin/devices/enroll/android") | userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/windows") ){ + permissions.ENROLL_DEVICE = true; + } viewModel.permissions = permissions; //TODO: Move enrollment URL into app-conf.json viewModel.enrollmentURL = mdmProps.generalConfig.host + mdmProps.enrollmentDir; 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.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/operation-bar.hbs index c8d704777..fc4b7fefb 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.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/operation-bar.hbs @@ -15,6 +15,7 @@ specific language governing permissions and limitations under the License. }} + {{#zone "content"}}
{{unit "mdm.unit.device.operation-mod"}} 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 d9390191f..d8e8b8405 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 @@ -17,55 +17,53 @@ */ function onRequest(context) { - var log = new Log("mdm.unit.device.operation-bar"); + // var log = new Log("mdm.unit.device.operation-bar"); var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var deviceType = context.uriParams.deviceType; var viewModel = {}; - var permissions = []; + var permissions = {}; - // permission checks - if (deviceType == "android") { - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/ring")) { - permissions.push("DEVICE_RING"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/lock-devices")) { - permissions.push("DEVICE_LOCK"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/unlock-devices")) { - permissions.push("DEVICE_UNLOCK"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/location")) { - permissions.push("DEVICE_LOCATION"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/clear-password")) { - permissions.push("CLEAR_PASSWORD"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/reboot")) { - permissions.push("DEVICE_REBOOT"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/upgrade-firmware")) { - permissions.push("UPGRADE_FIRMWARE"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/mute")) { - permissions.push("DEVICE_MUTE"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/send-notification")) { - permissions.push("NOTIFICATION"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/change-lock-code")) { - permissions.push("CHANGE_LOCK_CODE"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/enterprise-wipe")) { - permissions.push("ENTERPRISE_WIPE"); - } - if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/wipe")) { - permissions.push("WIPE_DATA"); - } - } else if (deviceType == "ios") { + // adding android operations related permission checks + permissions["android"] = []; + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/ring")) { + permissions["android"].push("DEVICE_RING"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/lock-devices")) { + permissions["android"].push("DEVICE_LOCK"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/unlock-devices")) { + permissions["android"].push("DEVICE_UNLOCK"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/location")) { + permissions["android"].push("DEVICE_LOCATION"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/clear-password")) { + permissions["android"].push("CLEAR_PASSWORD"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/reboot")) { + permissions["android"].push("DEVICE_REBOOT"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/upgrade-firmware")) { + permissions["android"].push("UPGRADE_FIRMWARE"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/mute")) { + permissions["android"].push("DEVICE_MUTE"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/send-notification")) { + permissions["android"].push("NOTIFICATION"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/change-lock-code")) { + permissions["android"].push("CHANGE_LOCK_CODE"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/enterprise-wipe")) { + permissions["android"].push("ENTERPRISE_WIPE"); + } + if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/android/wipe")) { + permissions["android"].push("WIPE_DATA"); + } - } else if (deviceType == "windows") { + // adding ios operations related permission checks - } + // adding windows operations related permission checks viewModel["permissions"] = stringify(permissions); 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 b609f3a70..a3186092a 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 @@ -108,21 +108,21 @@ function loadOperationBar(deviceType) { //var serviceURL = "/mdm-admin/features/" + platformType; var serviceURL = "/api/device-mgt/v1.0/devices/" + platformType + "/*/features"; var successCallback = function (data) { - var permittedOpps = []; + var permittedOperations = []; var i; var permissionList = $("#operations-mod").data("permissions"); var totalFeatures = JSON.parse(data); - for (i = 0; i < permissionList.length; i++) { + for (i = 0; i < permissionList[deviceType].length; i++) { var j; for (j = 0; j < totalFeatures.length; j++) { - if (permissionList[i] == totalFeatures[j]["code"]) { - permittedOpps.push(totalFeatures[j]); + if (permissionList[deviceType][i] == totalFeatures[j]["code"]) { + permittedOperations.push(totalFeatures[j]); } } } var viewModel = {}; - permittedOpps = permittedOpps.filter(function (current) { + permittedOperations = permittedOperations.filter(function (current) { var iconName; switch (deviceType) { case platformTypeConstants.ANDROID: @@ -143,7 +143,7 @@ function loadOperationBar(deviceType) { } }); - viewModel.features = permittedOpps; + viewModel.features = permittedOperations; var content = template(viewModel); $(".wr-operations").html(content); }; 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 7de3cc431..43a601915 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 @@ -108,14 +108,11 @@

{{#equal code "WIPE_DATA"}} {{#equal type "android"}} - Enter PIN code (Optional - This is required only if the device type - is BYOD). + Enter PIN code (Optional - This is required only if the device type is BYOD).

-
- +

{{/equal}} @@ -123,25 +120,114 @@ {{#equal code "NOTIFICATION"}} Type your message below.

- -

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 4dfc3b86c..8345741ac 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 @@ -2,373 +2,358 @@ {{unit "cdmf.unit.lib.qrcode"}} {{unit "mdm.unit.device.qr-modal"}} -{{#zone "contentTitle"}} - {{#if isAuthorized}} -
-
- -
-
- {{/if}} -{{/zone}} - {{#zone "content"}} {{#if isAuthorized}} -
-
-
-
-
-
-
Device Overview
- {{#defineZone "device-detail-properties"}} - - - - - - - {{#if device.viewModel.model}} - - - - - {{/if}} - - - - - {{#if device.viewModel.udid}} +

+ Device {{device.name}} + {{#if device.viewModel.model}} + + ( {{device.viewModel.vendor}} {{device.viewModel.model}} ) + + {{/if}} +

+
+
+
+
+
+
+
Device Overview
+ {{#defineZone "device-detail-properties"}} +
Device{{device.viewModel.vendor}} {{device.properties.model}}
Model{{device.viewModel.model}}
IMEI{{device.viewModel.imei}}
+ - - + + - {{/if}} - {{#if device.viewModel.os_build_date}} + {{#if device.viewModel.model}} + + + + + {{/if}} - - + + - {{/if}} - {{#if device.viewModel.phoneNumber}} + {{#if device.viewModel.udid}} + + + + + {{/if}} + {{#if device.viewModel.os_build_date}} + + + + + {{/if}} + {{#if device.viewModel.phoneNumber}} + + + + + {{/if}} - - + + - {{/if}} - - - - - -
UDID{{device.viewModel.udid}}Device{{device.viewModel.vendor}} {{device.properties.model}}
Model{{device.viewModel.model}}
Firmware Build Date{{device.viewModel.os_build_date}}IMEI{{device.viewModel.imei}}
UDID{{device.viewModel.udid}}
Firmware Build Date{{device.viewModel.os_build_date}}
Phone Number{{device.viewModel.phoneNumber}}
Phone Number{{device.viewModel.phoneNumber}}Status + {{#equal device.status "ACTIVE"}}  Active{{/equal}} + {{#equal device.status "INACTIVE"}}  Inactive{{/equal}} + {{#equal device.status "BLOCKED"}}  Blocked{{/equal}} + {{#equal device.status "REMOVED"}}  Removed{{/equal}} +
Status - {{#equal device.status "ACTIVE"}}  Active{{/equal}} - {{#equal device.status "INACTIVE"}}  Inactive{{/equal}} - {{#equal device.status "BLOCKED"}}  Blocked{{/equal}} - {{#equal device.status "REMOVED"}}  Removed{{/equal}} -
- {{/defineZone}} -
Operations
-
- {{unit "mdm.unit.device.operation-bar" deviceType=device.type}} + + + {{/defineZone}} +
Operations
+
+ {{unit "mdm.unit.device.operation-bar" deviceType=device.type}} +
-
-
- -
- {{#defineZone "device-detail-properties"}} -
-
- +
+ + {{#defineZone "device-detail-properties"}} +
+
+ -
- - -
-

       Loading Device Details . . .
-
-
-