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/DeviceManagementService.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/DeviceManagementService.java index c582886e9..291177ff7 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/DeviceManagementService.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/DeviceManagementService.java @@ -21,7 +21,6 @@ package org.wso2.carbon.mdm.services.android.services; import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.Permission; -import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; @@ -330,7 +329,7 @@ public interface DeviceManagementService { message = "Internal Server Error. \n " + "Server error occurred while dis-enrolling the device.") }) - @Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android") + @Permission(name = "Disenroll Device", permission = "/device-mgt/devices/disenroll/android") Response disEnrollDevice( @ApiParam( name = "id", 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 0147160d7..ddcf2a49d 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 @@ -179,8 +179,8 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { notification.setOperationId(operation.getId()); notification.setStatus(org.wso2.carbon.device.mgt.common.notification.mgt.Notification. Status.NEW.toString()); - notification.setDescription("Operation " + operation.getCode() + " failed to execute on device " + - deviceName + " with identifier : " + deviceId); + notification.setDescription(operation.getCode() + " operation did fail to execute on device " + + deviceName + " with identifier " + deviceId); AndroidAPIUtils.getNotificationManagementService().addNotification(id, notification); } if (log.isDebugEnabled()) { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml index 1ed463398..1c3c034b8 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml @@ -124,6 +124,15 @@ POST + + GET Events + /device-mgt/admin/events/get + /events + GET + + + + @@ -156,6 +165,13 @@ POST + + Logcat + /device-mgt/admin/device/android/operation/logcat + /admin/devices/logcat + POST + + Configure VPN /device-mgt/admin/device/android/operation/configure-vpn 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 edaeddafe..fa4688cda 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 @@ -15,6 +15,7 @@ specific language governing permissions and limitations under the License. }} + {{unit "cdmf.unit.ui.title" pageTitle="Device Management"}} {{unit "cdmf.unit.data-tables-extended"}} @@ -37,33 +38,23 @@ {{#zone "navbarActions"}} {{#if permissions.ENROLL_DEVICE}} -
  • +
  • {{/if}} {{#if permissions.ADVANCED_SEARCH}} -
  • +
  • @@ -72,39 +63,56 @@ {{#zone "content"}} {{#if permissions.VIEW_DEVICES}} + - {{else}}

    Permission Denied 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/public/js/device-listing.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/js/device-listing.js index 67c345e7f..f48713e26 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/public/js/device-listing.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/js/device-listing.js @@ -76,17 +76,72 @@ function loadDevices() { return {}; } - var fnCreatedRow = function (nRow, aData, dataIndex) { - $(nRow).attr('data-type', 'selectable'); - $(nRow).attr('data-deviceid', aData.deviceIdentifier); - $(nRow).attr('data-devicetype', aData.deviceType); + var dataFilter = function (data) { + var noDeviceView = "#no-device-view"; + + data = JSON.parse(data); + var json; + + if (data["count"] == 0) { + if ($(noDeviceView).length) { + $(noDeviceView).removeClass('hidden'); + } + + $(".bulk-action-row").addClass('hidden'); + + json = { + "recordsTotal": 0, + "recordsFiltered": 0, + "data": [] + }; + + return JSON.stringify(json); + + } else if (data["count"] > 0) { + $(noDeviceView).remove(); + $("#enroll-btn").removeClass('hidden'); + $("#advanced-search-btn").removeClass('hidden'); + $(".bulk-action-row").removeClass('hidden'); + $("#device-table").removeClass('hidden'); + + var objects = []; + + $(data.devices).each(function (index) { + objects.push( + { + model: getPropertyValue(data.devices[index].properties, "DEVICE_MODEL"), + vendor: getPropertyValue(data.devices[index].properties, "VENDOR"), + user: data.devices[index].enrolmentInfo.owner, + status: data.devices[index].enrolmentInfo.status, + ownership: data.devices[index].enrolmentInfo.ownership, + deviceType: data.devices[index].type, + deviceIdentifier: data.devices[index].deviceIdentifier, + name : data.devices[index].name + } + ); + }); + + json = { + "recordsTotal": data["count"], + "recordsFiltered": data["count"], + "data": objects + }; + + return JSON.stringify(json); + } }; + // possible params - nRow, aData, dataIndex + var fnCreatedRow = function (nRow, aData) { + $(nRow).attr('data-type', 'selectable'); + $(nRow).attr('data-devicetype', aData["deviceType"]); + $(nRow).attr('data-deviceid', aData["deviceIdentifier"]); + }; var columns = [ { class : 'remove-padding icon-only content-fill viewEnabledIcon', - data : 'icon', + data : null, render: function (data, type, row) { var deviceType = row.deviceType; var deviceIdentifier = row.deviceIdentifier; @@ -156,35 +211,6 @@ function loadDevices() { } ]; - - var dataFilter = function (data) { - data = JSON.parse(data); - - var objects = []; - - $(data.devices).each(function (index) { - objects.push( - { - model: getPropertyValue(data.devices[index].properties, "DEVICE_MODEL"), - vendor: getPropertyValue(data.devices[index].properties, "VENDOR"), - user: data.devices[index].enrolmentInfo.owner, - status: data.devices[index].enrolmentInfo.status, - ownership: data.devices[index].enrolmentInfo.ownership, - deviceType: data.devices[index].type, - deviceIdentifier: data.devices[index].deviceIdentifier, - name : data.devices[index].name - } - ); - }); - - var json = { - "recordsTotal": data.count, - "recordsFiltered": data.count, - "data": objects - }; - return JSON.stringify(json); - }; - $('#device-grid').datatables_extended_serverside_paging( null, "/api/device-mgt/v1.0/devices", @@ -220,29 +246,30 @@ function loadDevices() { //} function initPage() { - var currentUser = $("#device-listing").data("currentUser"); - var serviceURL = "/api/device-mgt/v1.0/devices"; - - invokerUtil.get( - serviceURL, - function (data) { - if (data) { - data = JSON.parse(data); - if (data["count"] > 0) { - $(".bulk-action-row").removeClass('hidden'); - $("#device-table").removeClass('hidden'); - loadDevices(); - } else { - $("#enroll-btn").addClass('hidden'); - $("#advanced-search-btn").addClass('hidden'); - $("#device-table").addClass('hidden'); - $("#no-device-view").removeClass('hidden'); - } - } - }, function () { - initPage(); - } - ); +// var currentUser = $("#device-listing").data("currentUser"); +// var serviceURL = "/api/device-mgt/v1.0/devices"; +// +// invokerUtil.get( +// serviceURL, +// function (data) { +// if (data) { +// data = JSON.parse(data); +// if (data["count"] > 0) { +// $(".bulk-action-row").removeClass('hidden'); +// $("#device-table").removeClass('hidden'); +// loadDevices(); +// } else { +// $("#enroll-btn").addClass('hidden'); +// $("#advanced-search-btn").addClass('hidden'); +// $("#device-table").addClass('hidden'); +// $("#no-device-view").removeClass('hidden'); +// } +// } +// }, function () { +// initPage(); +// } +// ); + loadDevices(); } /* 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.policy.create/public/js/policy-create.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js index 655acfc1d..6ee4e6d82 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js @@ -49,7 +49,9 @@ var androidOperationConstants = { "VPN_OPERATION": "vpn", "VPN_OPERATION_CODE": "VPN", "APPLICATION_OPERATION":"app-restriction", - "APPLICATION_OPERATION_CODE":"APP-RESTRICTION" + "APPLICATION_OPERATION_CODE":"APP-RESTRICTION", + "KIOSK_APPS_CODE":"KIOSK_APPS", + "KIOSK_APPS":"cosu-whitelisted-applications" }; // Constants to define iOS Operation Constants @@ -520,6 +522,93 @@ validateStep["policy-profile"] = function () { validationStatusArray.push(validationStatus); } + if ($.inArray(androidOperationConstants["KIOSK_APPS_CODE"], configuredOperations) != -1) { + //If COSU whitelisting applications configured + operation = androidOperationConstants["KIOSK_APPS"]; + // Initializing continueToCheckNextInputs to true + continueToCheckNextInputs = true; + + var whitelistedApplicationsGridChildInputs = "div#cosu-whitelisted-applications .child-input"; + + if (continueToCheckNextInputs) { + if ($(whitelistedApplicationsGridChildInputs).length == 0) { + validationStatus = { + "error": true, + "subErrorMsg": "Applications are not provided in application whitelist list.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + else { + childInputCount = 0; + childInputArray = []; + emptyChildInputCount = 0; + duplicatesExist = false; + // Looping through each child input + $(whitelistedApplicationsGridChildInputs).each(function () { + childInputCount++; + if (childInputCount % 2 == 0) { + // If child input is of second column + childInput = $(this).val(); + childInputArray.push(childInput); + // Updating emptyChildInputCount + if (!childInput) { + // If child input field is empty + emptyChildInputCount++; + } + } + }); + // Checking for duplicates + initialChildInputArrayLength = childInputArray.length; + if (emptyChildInputCount == 0 && initialChildInputArrayLength > 1) { + for (m = 0; m < (initialChildInputArrayLength - 1); m++) { + poppedChildInput = childInputArray.pop(); + for (n = 0; n < childInputArray.length; n++) { + if (poppedChildInput == childInputArray[n]) { + duplicatesExist = true; + break; + } + } + if (duplicatesExist) { + break; + } + } + } + // Updating validationStatus + if (emptyChildInputCount > 0) { + // If empty child inputs are present + validationStatus = { + "error": true, + "subErrorMsg": "One or more package names of " + + "applications are empty.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } else if (duplicatesExist) { + // If duplicate input is present + validationStatus = { + "error": true, + "subErrorMsg": "Duplicate values exist with " + + "for package names.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + + } + } + + if (continueToCheckNextInputs) { + validationStatus = { + "error": false, + "okFeature": operation + }; + } + + // Updating validationStatusArray with validationStatus + validationStatusArray.push(validationStatus); + + } } }if (policy["platform"] == platformTypeConstants["WINDOWS"]) { if (configuredOperations.length == 0) { 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.policy.create/public/templates/hidden-operations-android.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/templates/hidden-operations-android.hbs index 50aaf2a43..b77aaa7a6 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/templates/hidden-operations-android.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/templates/hidden-operations-android.hbs @@ -77,14 +77,14 @@ - + Whitelist Apps (COSU) - - - + + + @@ -1329,14 +1329,14 @@ -
    -
    +
    - -
    +

    - @@ -1469,14 +1458,14 @@
    -
    -
    +
    -

    {{#each notifications}} -
  • +
  • - Notification on {{deviceType}} {{deviceName}} + class="new-notification text-capitalize" data-click-event="remove-form"> + Failure on {{deviceType}} {{deviceName}}

    {{description}}