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.device.view/view.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.device.view/view.hbs index ab7bf0fcee..1f166ffbf1 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.device.view/view.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.device.view/view.hbs @@ -26,6 +26,7 @@
  • + Devices @@ -38,7 +39,15 @@ {{/zone}} {{#zone "content"}} - {{unit "cdmf.unit.lib.data-table"}} - {{unit "cdmf.unit.device.operation-mod"}} - {{unit "cdmf.unit.device.view"}} + {{#if isAuthorized}} + {{unit "cdmf.unit.lib.data-table"}} + {{unit "cdmf.unit.device.operation-mod"}} + {{unit "cdmf.unit.device.view"}} + {{else}} +

    + Permission Denied +

    +
    + You are not authorized to view any enrolled device in the system. + {{/if}} {{/zone}} \ 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/pages/mdm.page.device.view/view.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.device.view/view.js index 21ce993020..1f7e9c0881 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.device.view/view.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.device.view/view.js @@ -17,17 +17,24 @@ */ function onRequest(context){ - var utility = require("/app/modules/utility.js").utility; - context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { - if (arguments.length < 3) - throw new Error("Handlebars Helper equal needs 2 parameters"); - if( lvalue!=rvalue ) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); + var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; + var viewModel = {}; - var deviceType = context.uriParams.deviceType; - return {"deviceViewUnitName": utility.getTenantedDeviceUnitName(deviceType, "device-view")}; + // permission checks + // [1] checking viewing devices permission + viewModel["isAuthorized"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/view"); + + if (viewModel["isAuthorized"]) { + context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { + if (arguments.length < 3) + throw new Error("Handlebars Helper equal needs 2 parameters"); + if( lvalue!=rvalue ) { + return options.inverse(this); + } else { + return options.fn(this); + } + }); + } + + return viewModel; } 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.devices/devices.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs index 0c56529574..b56d066f1c 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs @@ -156,6 +156,12 @@

    + {{else}} +

    + Permission Denied +

    +
    + You are not authorized to view any enrolled device in the system. {{/if}} {{/zone}} 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.policies/policies.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/policies.hbs index d71b65cf60..5737957bd1 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/policies.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/policies.hbs @@ -261,378 +261,388 @@
    -
    -
    -
    -

    Do you really want to remove the selected policy(s)?

    - -
    - - Remove - + + -
    +
    +
    -
    -
    -
    -

    Done. Selected policy was successfully removed.

    + + +
    +
    -
    -
    -
    -

    An unexpected error occurred. Please try again later.

    + + +
    +
    -
    -
    -
    -

    - You cannot remove policies that have been already applied to devices. - Please deselect active policies from your selection and try again. -

    - - -
    + + +
    -
    -
    -
    -

    Do you really want to publish the selected policy(s)?

    - -
    - Yes - No -
    -
    + + +
    -
    -
    -
    -

    Done. Selected policy was successfully published.

    - - -
    + + +
    -
    -
    -
    -

    An unexpected error occurred. Please try again later.

    - - -
    + + +
    -
    -
    -
    -

    Do you really want to unpublish the selected policy(s)?

    - -
    - - Yes - + + + + + No +
    -
    -
    -
    -

    Done. Selected policy was successfully unpublished.

    - - -
    + + +
    -
    -
    -
    -

    An unexpected error occurred. Please try again later.

    - - -
    + + +
    -
    -
    -
    -

    Done. New Policy priorities were successfully updated.

    - - -
    + + +
    -
    -
    -
    -

    An unexpected error occurred. Please try again later.

    -

    - - -
    + + +
    -
    -
    -
    -

    Do you really want to apply changes to all policies?

    - -
    - - Yes - + + + + + No +
    -
    -
    -
    -

    Done. Changes applied successfully.

    - - -
    + + +
    -
    -
    -
    -

    An unexpected error occurred. Please try again later.

    - - -
    + + +
    -
    -
    -
    -

    - + + Action cannot be performed ! +

    + +
    + +
    -
    -
    -
    -

    - + + Action cannot be performed ! +

    + +
    + +
    -
    -
    -
    -

    - + + Action cannot be performed ! +

    + +
    + +
    -
    -
    -
    -

    - + + Action cannot be performed ! +

    + +
    + +
    -
    -
    -
    -

    - + + Action cannot be performed ! +

    + +
    + +
    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.policies/public/js/policy-list.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/public/js/policy-list.js index d6c121ebe7..e6eb9bf045 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/public/js/policy-list.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/public/js/policy-list.js @@ -82,7 +82,6 @@ function setPopupMaxHeight() { */ function showPopup() { $(modalPopup).modal('show'); - //setPopupMaxHeight(); } /* 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-mod/public/js/operation-mod.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-mod/public/js/operation-mod.js index 3f1219765d..f47bbd9976 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-mod/public/js/operation-mod.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-mod/public/js/operation-mod.js @@ -115,8 +115,8 @@ var operationModule = function () { var featureMap = { "DEVICE_LOCK": "lock", "VPN": "vpn", - "PER_APP_VPN": "perappvpn", - "APP_TO_PER_APP_VPN_MAPPING": "apptoperappvpnmapping", + "PER_APP_VPN": "per-app-vpn", + "APP_TO_PER_APP_VPN_MAPPING": "app-to-per-app-vpn-mapping", "RING": "ring", "LOCATION": "location", "NOTIFICATION": "notification", @@ -124,12 +124,12 @@ var operationModule = function () { "RESTRICTION": "restriction", "CELLULAR": "cellular", "WIFI": "wifi", - "INSTALL_STORE_APPLICATION": "storeapplication", - "INSTALL_ENTERPRISE_APPLICATION": "enterpriseapplication", - "REMOVE_APPLICATION": "removeapplication", - "ENTERPRISE_WIPE": "enterprisewipe" + "INSTALL_STORE_APPLICATION": "store-application", + "INSTALL_ENTERPRISE_APPLICATION": "enterprise-application", + "REMOVE_APPLICATION": "remove-application", + "ENTERPRISE_WIPE": "enterprise-wipe" }; - return "/ios/operation/" + featureMap[operationCode]; + return "/api/device-mgt/ios/v1.0/admin/devices/" + featureMap[operationCode]; }; /** 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.qr-modal/qr-modal.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.qr-modal/qr-modal.hbs index d1c3e40a1c..5da7c3427e 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.qr-modal/qr-modal.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.qr-modal/qr-modal.hbs @@ -17,20 +17,27 @@ }} {{#zone "content"}}