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 new file mode 100644 index 000000000..ab7bf0fce --- /dev/null +++ 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 @@ -0,0 +1,44 @@ +{{! + 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.ui.title" pageTitle="Device Details"}} +{{unit "cdmf.unit.lib.service-invoker-utility"}} +{{unit "cdmf.unit.lib.handlebars"}} + +{{#zone "breadcrumbs"}} +
  • + + + +
  • +
  • + + Devices + +
  • +
  • + + Device Details + +
  • +{{/zone}} + +{{#zone "content"}} + {{unit "cdmf.unit.lib.data-table"}} + {{unit "cdmf.unit.device.operation-mod"}} + {{unit "cdmf.unit.device.view"}} +{{/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 new file mode 100644 index 000000000..21ce99302 --- /dev/null +++ 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 @@ -0,0 +1,33 @@ +/* + * 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 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 deviceType = context.uriParams.deviceType; + return {"deviceViewUnitName": utility.getTenantedDeviceUnitName(deviceType, "device-view")}; +} 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.json 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.json new file mode 100644 index 000000000..04395bd8f --- /dev/null +++ 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.json @@ -0,0 +1,4 @@ +{ + "version": "1.0.0", + "extends": "cdmf.page.device.view" +} \ 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.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 8952faac1..a515fbd0d 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 @@ -204,7 +204,7 @@ function loadDevices(searchType, searchParam){ var deviceIdentifier = row.deviceIdentifier; var url = "#"; if (status != 'REMOVED') { - url = "devices/view?type=" + deviceType + "&id=" + deviceIdentifier; + url = "device/" + deviceType + "?id=" + deviceIdentifier; } return '
    ' } 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 b35faac5a..3f1219765 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 @@ -1,17 +1,17 @@ /* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * 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 + * 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 + * "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. */ @@ -37,12 +37,50 @@ var operationModule = function () { // 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", - "CHANGE_LOCK_CODE_OPERATION_CODE": "CHANGE_LOCK_CODE" + "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" }; // Constants to define Windows Operation Constants @@ -58,6 +96,7 @@ var operationModule = function () { 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", @@ -66,13 +105,19 @@ var operationModule = function () { "NOTIFICATION_OPERATION_CODE": "NOTIFICATION", "CALENDAR_SUBSCRIPTION_OPERATION_CODE": "CALENDAR_SUBSCRIPTION", "APN_OPERATION_CODE": "APN", - "CELLULAR_OPERATION_CODE": "CELLULAR" + "DOMAIN_CODE": "DOMAIN", + "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", - "ALARM": "alarm", + "VPN": "vpn", + "PER_APP_VPN": "perappvpn", + "APP_TO_PER_APP_VPN_MAPPING": "apptoperappvpnmapping", + "RING": "ring", "LOCATION": "location", "NOTIFICATION": "notification", "AIR_PLAY": "airplay", @@ -182,6 +227,76 @@ var operationModule = function () { "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"], @@ -222,31 +337,31 @@ var operationModule = function () { 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"], - "emailDisableMailRecentSyncing": operationPayload["disableMailRecentSyncing"], - "emailIncomingMailServerIMAPPathPrefix": operationPayload["incomingMailServerIMAPPathPrefix"], - "emailSMIMEEnabled": operationPayload["smimeenabled"], - "emailSMIMESigningCertificateUUID": operationPayload["smimesigningCertificateUUID"], - "emailSMIMEEncryptionCertificateUUID": operationPayload["smimeencryptionCertificateUUID"], - "emailSMIMEEnablePerMessageSwitch": operationPayload["smimeenablePerMessageSwitch"] + "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"], + "emailDisableMailRecentSyncing": operationPayload["disableMailRecentSyncing"], + "emailIncomingMailServerIMAPPathPrefix": operationPayload["incomingMailServerIMAPPathPrefix"], + "emailSMIMEEnabled": operationPayload["smimeenabled"], + "emailSMIMESigningCertificateUUID": operationPayload["smimesigningCertificateUUID"], + "emailSMIMEEncryptionCertificateUUID": operationPayload["smimeencryptionCertificateUUID"], + "emailSMIMEEnablePerMessageSwitch": operationPayload["smimeenablePerMessageSwitch"] }; break; case iosOperationConstants["AIRPLAY_OPERATION_CODE"]: @@ -367,6 +482,112 @@ var operationModule = function () { } }; break; + case iosOperationConstants["VPN_OPERATION_CODE"]: + operationType = operationTypeConstants["PROFILE"]; + var ppp = {}; + var ipSec = {}; + var ikev2 = {}; + 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"] + }; + } + + 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 + } + }; + 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 = { @@ -528,6 +749,15 @@ var operationModule = function () { } }; break; + case iosOperationConstants["DOMAIN_CODE"]: + operationType = operationTypeConstants["PROFILE"]; + payload = { + "operation": { + "emailDomains": operationData["emailDomains"], + "webDomains": operationData["webDomains"] + } + }; + break; case iosOperationConstants["CELLULAR_OPERATION_CODE"]: operationType = operationTypeConstants["PROFILE"]; payload = { @@ -544,7 +774,7 @@ var operationModule = function () { operationType = operationTypeConstants["PROFILE"]; payload = { "operation": { - "message": operationData["message"] + "message" : operationData["message"] } }; break; @@ -584,9 +814,7 @@ var operationModule = function () { }; break; case androidOperationConstants["CAMERA_OPERATION_CODE"]: - payload = { - "cameraEnabled": operationPayload["enabled"] - }; + payload = operationPayload; break; case androidOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"]: payload = { @@ -596,7 +824,29 @@ var operationModule = function () { case androidOperationConstants["WIFI_OPERATION_CODE"]: payload = { "wifiSSID": operationPayload["ssid"], - "wifiPassword": operationPayload["password"] + "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; } @@ -611,7 +861,40 @@ var operationModule = function () { operationType = operationTypeConstants["PROFILE"]; payload = { "operation": { - "enabled": operationData["cameraEnabled"] + "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["diableScreenCapture"], + "SET_STATUS_BAR_DISABLED" : operationData["disableStatusBar"] } }; break; @@ -619,7 +902,7 @@ var operationModule = function () { operationType = operationTypeConstants["PROFILE"]; payload = { "operation": { - "lockCode": operationData["lockCode"] + "lockCode" : operationData["lockCode"] } }; break; @@ -627,7 +910,7 @@ var operationModule = function () { operationType = operationTypeConstants["PROFILE"]; payload = { "operation": { - "encrypted": operationData["encryptStorageEnabled"] + "encrypted" : operationData["encryptStorageEnabled"] } }; break; @@ -635,7 +918,18 @@ var operationModule = function () { operationType = operationTypeConstants["PROFILE"]; payload = { "operation": { - "message": operationData["message"] + //"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; @@ -643,7 +937,7 @@ var operationModule = function () { operationType = operationTypeConstants["PROFILE"]; payload = { "operation": { - "pin": operationData["pin"] + "pin" : operationData["pin"] } }; break; @@ -652,7 +946,47 @@ var operationModule = function () { payload = { "operation": { "ssid": operationData["wifiSSID"], - "password": operationData["wifiPassword"] + "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; @@ -670,6 +1004,14 @@ var operationModule = function () { } }; break; + case androidOperationConstants["APPLICATION_OPERATION_CODE"]: + payload = { + "operation": { + "restriction-type": operationData["restrictionType"], + "restricted-applications": operationData["restrictedApplications"] + } + }; + break; default: // If the operation is neither of above, it is a command operation operationType = operationTypeConstants["COMMAND"]; @@ -686,28 +1028,31 @@ var operationModule = function () { publicMethods.getAndroidServiceEndpoint = function (operationCode) { var featureMap = { - "WIFI": "wifi", - "CAMERA": "camera", - "DEVICE_LOCK": "lock", + "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", - "DEVICE_REBOOT": "reboot-device", + "DEVICE_RING": "ring", + "DEVICE_REBOOT": "reboot", "UPGRADE_FIRMWARE": "upgrade-firmware", "DEVICE_MUTE": "mute", - "NOTIFICATION": "notification", - "ENCRYPT_STORAGE": "encrypt", + "NOTIFICATION": "send-notification", + "ENCRYPT_STORAGE": "encrypt-storage", "CHANGE_LOCK_CODE": "change-lock-code", - "WEBCLIP": "webclip", + "WEBCLIP": "set-webclip", "INSTALL_APPLICATION": "install-application", "UNINSTALL_APPLICATION": "uninstall-application", "BLACKLIST_APPLICATIONS": "blacklist-applications", - "PASSCODE_POLICY": "password-policy", + "PASSCODE_POLICY": "set-password-policy", "ENTERPRISE_WIPE": "enterprise-wipe", - "WIPE_DATA": "wipe-data" + "WIPE_DATA": "wipe" }; - return "/mdm-android-agent/operation/" + featureMap[operationCode]; + //return "/mdm-android-agent/operation/" + featureMap[operationCode]; + return "/api/device-mgt/android/v1.0/admin/devices/" + featureMap[operationCode]; }; /** @@ -754,7 +1099,7 @@ var operationModule = function () { operationType = operationTypeConstants["PROFILE"]; payload = { "operation": { - "enabled": operationData["cameraEnabled"] + "enabled" : operationData["cameraEnabled"] } }; break; @@ -762,7 +1107,7 @@ var operationModule = function () { operationType = operationTypeConstants["PROFILE"]; payload = { "operation": { - "lockCode": operationData["lockCode"] + "lockCode" : operationData["lockCode"] } }; break; @@ -770,7 +1115,7 @@ var operationModule = function () { operationType = operationTypeConstants["PROFILE"]; payload = { "operation": { - "encrypted": operationData["encryptStorageEnabled"] + "encrypted" : operationData["encryptStorageEnabled"] } }; break; @@ -778,7 +1123,7 @@ var operationModule = function () { operationType = operationTypeConstants["PROFILE"]; payload = { "operation": { - "message": operationData["message"] + "message" : operationData["message"] } }; break; @@ -852,9 +1197,10 @@ var operationModule = function () { "DEVICE_RING": "fw-dial-up", "DEVICE_REBOOT": "fw-refresh", "UPGRADE_FIRMWARE": "fw-up-arrow", - "DEVICE_MUTE": "fw-incoming-call", + "DEVICE_MUTE": "fw-mute", "NOTIFICATION": "fw-message", - "CHANGE_LOCK_CODE": "fw-security" + "CHANGE_LOCK_CODE": "fw-security", + "DEVICE_UNLOCK": "fw-lock" }; return featureMap[operationCode]; }; @@ -891,7 +1237,7 @@ var operationModule = function () { "LOCATION": "fw-map-location", "ENTERPRISE_WIPE": "fw-clear", "NOTIFICATION": "fw-message", - "ALARM": "fw-dial-up" + "RING": "fw-dial-up" }; return featureMap[operationCode]; }; @@ -904,9 +1250,7 @@ var operationModule = function () { */ $.fn.filterByData = function (prop, val) { return this.filter( - function () { - return $(this).data(prop) == val; - } + function () {return $(this).data(prop) == val;} ); }; @@ -928,7 +1272,7 @@ var operationModule = function () { var key = operationDataObj.data("key"); var value; if (operationDataObj.is(":text") || operationDataObj.is("textarea") || - operationDataObj.is(":password")) { + operationDataObj.is(":password") || operationDataObj.is(":hidden")) { value = operationDataObj.val(); } else if (operationDataObj.is(":checkbox")) { value = operationDataObj.is(":checked"); @@ -941,7 +1285,8 @@ var operationModule = function () { if (operationDataObj.hasClass("one-column-input-array")) { $(".child-input", this).each(function () { childInput = $(this); - if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")) { + if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") + || childInput.is(":hidden")) { childInputValue = childInput.val(); } else if (childInput.is(":checkbox")) { childInputValue = childInput.is(":checked"); @@ -967,7 +1312,8 @@ var operationModule = function () { var joinedInput; $(".child-input", this).each(function () { childInput = $(this); - if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")) { + if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") + || childInput.is(":hidden")) { childInputValue = childInput.val(); } else if (childInput.is(":checkbox")) { childInputValue = childInput.is(":checked"); @@ -998,7 +1344,8 @@ var operationModule = function () { $(".child-input", this).each(function () { childInput = $(this); childInputKey = childInput.data("child-key"); - if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password")) { + if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") + || childInput.is(":hidden")) { childInputValue = childInput.val(); } else if (childInput.is(":checkbox")) { childInputValue = childInput.is(":checked"); @@ -1026,6 +1373,7 @@ var operationModule = function () { operationData[key] = value; } ); + switch (platformType) { case platformTypeConstants["ANDROID"]: payload = privateMethods.generateAndroidOperationPayload(operationCode, operationData, deviceList); @@ -1089,58 +1437,94 @@ var operationModule = function () { // var childInputValue; if (operationDataObj.hasClass("one-column-input-array")) { // generating input fields to populate complex value - for (i = 0; i < value.length; ++i) { - operationDataObj.parent().find("a").filterByData("click-event", "add-form").click(); - } - // traversing through each child input - $(".child-input", this).each(function () { - childInput = $(this); - var childInputValue = value[childInputIndex]; - // populating extracted value in the UI according to the input type - if (childInput.is(":text") || - childInput.is("textarea") || - childInput.is(":password") || - childInput.is("select")) { - childInput.val(childInputValue); - } else if (childInput.is(":checkbox")) { - operationDataObj.prop("checked", childInputValue); + if (value) { + for (i = 0; i < value.length; ++i) { + operationDataObj.parent().find("a").filterByData("click-event", "add-form").click(); } - // incrementing childInputIndex - childInputIndex++; - }); + // traversing through each child input + $(".child-input", this).each(function () { + childInput = $(this); + var childInputValue = value[childInputIndex]; + // populating extracted value in the UI according to the input type + if (childInput.is(":text") || + childInput.is(":hidden") || + childInput.is("textarea") || + childInput.is(":password") || + childInput.is("select")) { + childInput.val(childInputValue); + } else if (childInput.is(":checkbox")) { + operationDataObj.prop("checked", childInputValue); + } + // incrementing childInputIndex + childInputIndex++; + }); + } } else if (operationDataObj.hasClass("valued-check-box-array")) { // traversing through each child input $(".child-input", this).each(function () { childInput = $(this); // check if corresponding value of current checkbox exists in the array of values - if (value.indexOf(childInput.data("value")) != -1) { - // if YES, set checkbox as checked - childInput.prop("checked", true); + if (value) { + if (value.indexOf(childInput.data("value")) != -1) { + // if YES, set checkbox as checked + childInput.prop("checked", true); + } } }); } else if (operationDataObj.hasClass("multi-column-joined-input-array")) { // generating input fields to populate complex value - for (i = 0; i < value.length; ++i) { - operationDataObj.parent().find("a").filterByData("click-event", "add-form").click(); + if (value) { + for (i = 0; i < value.length; ++i) { + operationDataObj.parent().find("a").filterByData("click-event", "add-form").click(); + } + var columnCount = operationDataObj.data("column-count"); + var multiColumnJoinedInputArrayIndex = 0; + // handling scenarios specifically + if (operationDataObj.attr("id") == "wifi-mcc-and-mncs") { + // traversing through each child input + $(".child-input", this).each(function () { + childInput = $(this); + var multiColumnJoinedInput = value[multiColumnJoinedInputArrayIndex]; + var childInputValue; + if ((childInputIndex % columnCount) == 0) { + childInputValue = multiColumnJoinedInput.substring(3, 0) + } else { + childInputValue = multiColumnJoinedInput.substring(3); + // incrementing childInputIndex + multiColumnJoinedInputArrayIndex++; + } + // populating extracted value in the UI according to the input type + if (childInput.is(":text") || + childInput.is(":hidden") || + childInput.is("textarea") || + childInput.is(":password") || + childInput.is("select")) { + childInput.val(childInputValue); + } else if (childInput.is(":checkbox")) { + operationDataObj.prop("checked", childInputValue); + } + // incrementing childInputIndex + childInputIndex++; + }); + } } - var columnCount = operationDataObj.data("column-count"); - var multiColumnJoinedInputArrayIndex = 0; - // handling scenarios specifically - if (operationDataObj.attr("id") == "wifi-mcc-and-mncs") { + } else if (operationDataObj.hasClass("multi-column-key-value-pair-array")) { + // generating input fields to populate complex value + if (value) { + for (i = 0; i < value.length; ++i) { + operationDataObj.parent().find("a").filterByData("click-event", "add-form").click(); + } + columnCount = operationDataObj.data("column-count"); + var multiColumnKeyValuePairArrayIndex = 0; // traversing through each child input $(".child-input", this).each(function () { childInput = $(this); - var multiColumnJoinedInput = value[multiColumnJoinedInputArrayIndex]; - var childInputValue; - if ((childInputIndex % columnCount) == 0) { - childInputValue = multiColumnJoinedInput.substring(3, 0) - } else { - childInputValue = multiColumnJoinedInput.substring(3); - // incrementing childInputIndex - multiColumnJoinedInputArrayIndex++; - } + var multiColumnKeyValuePair = value[multiColumnKeyValuePairArrayIndex]; + var childInputKey = childInput.data("child-key"); + var childInputValue = multiColumnKeyValuePair[childInputKey]; // populating extracted value in the UI according to the input type if (childInput.is(":text") || + childInput.is(":hidden") || childInput.is("textarea") || childInput.is(":password") || childInput.is("select")) { @@ -1148,39 +1532,14 @@ var operationModule = function () { } else if (childInput.is(":checkbox")) { operationDataObj.prop("checked", childInputValue); } + // incrementing multiColumnKeyValuePairArrayIndex for the next row of inputs + if ((childInputIndex % columnCount) == (columnCount - 1)) { + multiColumnKeyValuePairArrayIndex++; + } // incrementing childInputIndex childInputIndex++; }); } - } else if (operationDataObj.hasClass("multi-column-key-value-pair-array")) { - // generating input fields to populate complex value - for (i = 0; i < value.length; ++i) { - operationDataObj.parent().find("a").filterByData("click-event", "add-form").click(); - } - columnCount = operationDataObj.data("column-count"); - var multiColumnKeyValuePairArrayIndex = 0; - // traversing through each child input - $(".child-input", this).each(function () { - childInput = $(this); - var multiColumnKeyValuePair = value[multiColumnKeyValuePairArrayIndex]; - var childInputKey = childInput.data("child-key"); - var childInputValue = multiColumnKeyValuePair[childInputKey]; - // populating extracted value in the UI according to the input type - if (childInput.is(":text") || - childInput.is("textarea") || - childInput.is(":password") || - childInput.is("select")) { - childInput.val(childInputValue); - } else if (childInput.is(":checkbox")) { - operationDataObj.prop("checked", childInputValue); - } - // incrementing multiColumnKeyValuePairArrayIndex for the next row of inputs - if ((childInputIndex % columnCount) == (columnCount - 1)) { - multiColumnKeyValuePairArrayIndex++; - } - // incrementing childInputIndex - childInputIndex++; - }); } } } @@ -1199,8 +1558,29 @@ var operationModule = function () { for (var i = 0; i < operationCodes.length; ++i) { var operationCode = operationCodes[i]; var payload = publicMethods.generatePayload(platformType, operationCode, null); - generatedProfile[operationCode] = payload["operation"]; + + 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"]; + } } + console.log(generatedProfile); return generatedProfile; }; @@ -1213,14 +1593,125 @@ var operationModule = function () { */ publicMethods.populateProfile = function (platformType, 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["diableScreenCapture"] = 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)); + } return configuredOperations; }; 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/img/device_icons/TemperatureController.png 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/img/device_icons/TemperatureController.png new file mode 100644 index 000000000..e16b48d8e Binary files /dev/null and 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/img/device_icons/TemperatureController.png differ 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/img/device_icons/android.png 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/img/device_icons/android.png new file mode 100755 index 000000000..7fee78a64 Binary files /dev/null and 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/img/device_icons/android.png differ 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/img/device_icons/ios.png 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/img/device_icons/ios.png new file mode 100644 index 000000000..4b09796f8 Binary files /dev/null and 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/img/device_icons/ios.png differ 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/img/graph.png 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/img/graph.png new file mode 100644 index 000000000..dd819ef4f Binary files /dev/null and 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/img/graph.png differ 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 new file mode 100644 index 000000000..074095034 --- /dev/null +++ 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 @@ -0,0 +1,318 @@ +/* + * 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 InitiateViewOption = null; + +(function () { + var deviceId = $(".device-id"); + var deviceIdentifier = deviceId.data("deviceid"); + var deviceType = deviceId.data("type"); + var payload = [deviceIdentifier]; + var operationTable; + var serviceUrl; + + if (deviceType == "ios") { + serviceUrl = "/ios/operation/deviceinfo"; + } else if (deviceType == "android") { + //var serviceUrl = "/mdm-android-agent/operation/device-info"; + serviceUrl = "/api/device-mgt/android/v1.0/admin/devices/info"; + } + + if (serviceUrl) { + invokerUtil.post( + serviceUrl, + payload, + // success-callback + function () { + $(".panel-body").show(); + }, + // error-callback + function () { + var defaultInnerHTML = + "

    Device data may not have been updated. Please refresh to try again.

    "; + $(".panel-body").append(defaultInnerHTML); + } + ); + } + + $(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) { + var activeTabPane = $(e.target).attr("href"), + activeCollapsePane = $(activeTabPane).find("[data-toggle=collapse]").data("target"), + activeCollapsePaneSiblings = $(activeTabPane).siblings().find("[data-toggle=collapse]").data("target"), + activeListGroupItem = $(".media .list-group-item.active"); + + $(activeCollapsePaneSiblings).collapse("hide"); + $(activeCollapsePane).collapse("show"); + positionArrow(activeListGroupItem); + + $(".panel-heading .caret-updown").removeClass("fw-sort-down"); + $(".panel-heading.collapsed .caret-updown").addClass("fw-sort-up"); + }); + + $(".media.tab-responsive .tab-content").on("shown.bs.collapse", function (e) { + var activeTabPane = $(e.target).parent().attr("id"); + $(".media.tab-responsive [data-toggle=tab][href=#" + activeTabPane + "]").tab("show"); + $(".panel-heading .caret-updown").removeClass("fw-sort-up"); + $(".panel-heading.collapsed .caret-updown").addClass("fw-sort-down"); + }); + + function positionArrow(selectedTab) { + var selectedTabHeight = $(selectedTab).outerHeight(); + var arrowPosition = 0; + var totalHeight = 0; + var arrow = $(".media .panel-group.tab-content .arrow-left"); + var parentHeight = $(arrow).parent().outerHeight(); + +// if($(selectedTab).prev().length){ +// $(selectedTab).prevAll().each(function() { +// totalHeight += $(this).outerHeight(); +// }); +// arrowPosition = totalHeight + (selectedTabHeight / 2); +// }else{ +// arrowPosition = selectedTabHeight / 2; +// } + + if(arrowPosition >= parentHeight){ + parentHeight = arrowPosition + 10; + $(arrow).parent().height(parentHeight); + }else{ + $(arrow).parent().removeAttr("style"); + } + $(arrow).css("top", arrowPosition - 10); + } + + $(document).ready(function() { + $(".device-detail-body").removeClass("hidden"); + $("#loading-content").remove(); + loadOperationBar(deviceType); + loadOperationsLog(false); + loadApplicationsList(); + loadPolicyCompliance(); + + $("#refresh-policy").click(function () { + $("#policy-spinner").removeClass("hidden"); + loadPolicyCompliance(); + }); + + $("#refresh-apps").click(function () { + $("#apps-spinner").removeClass("hidden"); + loadApplicationsList(); + }); + + $("#refresh-operations").click(function () { + $("#operations-spinner").removeClass("hidden"); + loadOperationsLog(true); + }); + }); + + function loadOperationsLog(update) { + var operationsLogTable = "#operations-log-table"; + if (update) { + operationTable = $(operationsLogTable).DataTable(); + operationTable.ajax.reload(false); + return; + } + operationTable = $(operationsLogTable).datatables_extended({ + serverSide: true, + processing: false, + searching: false, + ordering: false, + pageLength : 10, + order: [], + ajax: { + url: "/emm/api/operation/paginate", + data: {deviceId : deviceIdentifier, deviceType: deviceType}, + dataSrc: function (json) { + $("#operations-spinner").addClass("hidden"); + $("#operations-log-container").empty(); + return json.data; + } + }, + columnDefs: [ + {targets: 0, data: "code" }, + {targets: 1, data: "status", render: + function (status) { + var html; + switch (status) { + case "COMPLETED" : + html = " Completed"; + break; + case "PENDING" : + html = " Pending"; + break; + case "ERROR" : + html = " Error"; + break; + case "IN_PROGRESS" : + html = " In Progress"; + break; + case "REPEATED" : + html = " Repeated"; + break; + } + return html; + } + }, + {targets: 2, data: "createdTimeStamp", render: + function (date) { + var value = String(date); + return value.slice(0, 16); + } + } + ], + "createdRow": function(row, data) { + $(row).attr("data-type", "selectable"); + $(row).attr("data-id", data["id"]); + $.each($("td", row), + function(colIndex) { + switch(colIndex) { + case 1: + $(this).attr("data-grid-label", "Code"); + $(this).attr("data-display", data["code"]); + break; + case 2: + $(this).attr("data-grid-label", "Status"); + $(this).attr("data-display", data["status"]); + break; + case 3: + $(this).attr("data-grid-label", "Created Timestamp"); + $(this).attr("data-display", data["createdTimeStamp"]); + break; + } + } + ); + } + }); + } + + function loadApplicationsList() { + var applicationsList = $("#applications-list"); + var applicationListingTemplate = applicationsList.attr("src"); + var deviceId = applicationsList.data("device-id"); + var deviceType = applicationsList.data("device-type"); + + $.template("application-list", applicationListingTemplate, function (template) { + var serviceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/applications"; + invokerUtil.get( + serviceURL, + // success-callback + function (data, textStatus, jqXHR) { + if (jqXHR.status == 200 && data) { + data = JSON.parse(data); + $("#apps-spinner").addClass("hidden"); + if (data.length > 0) { + for (var i = 0; i < data.length; i++) { + data[i]["name"] = decodeURIComponent(data[i]["name"]); + data[i]["platform"] = deviceType; + } + + var viewModel = {}; + viewModel["applications"] = data; + viewModel["deviceType"] = deviceType; + var content = template(viewModel); + $("#applications-list-container").html(content); + } else { + $("#applications-list-container"). + html("


     No applications found. " + + "please try refreshing the list in a while.

    "); + } + } + }, + // error-callback + function () { + $("#applications-list-container"). + html("

     Loading application list " + + "was not successful. please try refreshing the list in a while.

    "); + }); + }); + } + + function loadPolicyCompliance() { + var policyCompliance = $("#policy-view"); + var policyComplianceTemplate = policyCompliance.attr("src"); + var deviceId = policyCompliance.data("device-id"); + var deviceType = policyCompliance.data("device-type"); + var activePolicy = null; + + $.template( + "policy-view", + policyComplianceTemplate, + function (template) { + var getEffectivePolicyURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/effective-policy"; + var getDeviceComplianceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/compliance-data"; + + invokerUtil.get( + getEffectivePolicyURL, + // success-callback + function (data, textStatus, jqXHR) { + if (jqXHR.status == 200 && data) { + data = JSON.parse(data); + $("#policy-spinner").addClass("hidden"); + if (data["active"] == true) { + activePolicy = data; + invokerUtil.get( + getDeviceComplianceURL, + // success-callback + function (data, textStatus, jqXHR) { + if (jqXHR.status == 200 && data) { + var viewModel = {}; + viewModel["policy"] = activePolicy; + viewModel["deviceType"] = deviceType; + data = JSON.parse(data); + var content; + if (data["complianceData"]) { + if (data["complianceData"]["complianceFeatures"] && + data["complianceData"]["complianceFeatures"].length > 0) { + viewModel["compliance"] = "NON-COMPLIANT"; + viewModel["complianceFeatures"] = data["complianceData"]["complianceFeatures"]; + content = template(viewModel); + $("#policy-list-container").html(content); + } else { + viewModel["compliance"] = "COMPLIANT"; + content = template(viewModel); + $("#policy-list-container").html(content); + $("#policy-compliance-table").addClass("hidden"); + } + } else { + $("#policy-list-container"). + html("

    This device " + + "has no policy applied.

    "); + } + } + }, + // error-callback + function () { + $("#policy-list-container"). + html("

    Loading policy compliance related data " + + "was not successful. please try refreshing data in a while.

    "); + } + ); + } + } + }, + // error-callback + function () { + $("#policy-list-container"). + html("

    Loading policy compliance related data " + + "was not successful. please try refreshing data in a while.

    "); + } + ); + } + ); + } +}()); 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/load-map.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/load-map.js new file mode 100644 index 000000000..895f75b94 --- /dev/null +++ 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/load-map.js @@ -0,0 +1,54 @@ +/* + * 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 map; + +function loadLeafletMap() { + var deviceLocationID = "#device-location", + lat = $(deviceLocationID).data("lat"), + long = $(deviceLocationID).data("long"), + container = "device-location", + zoomLevel = 13, + tileSet = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", + attribution = "© OpenStreetMap contributors"; + + if (lat && long) { + map = L.map(container).setView([lat, long], zoomLevel); + L.tileLayer(tileSet, {attribution: attribution}).addTo(map); + L.marker([lat, long]).addTo(map).bindPopup("Device is here...").openPopup(); + + $("#map-error").hide(); + $("#device-location").show(); + } else { + $("#device-location").hide(); + $("#map-error").show(); + } +} + +$(document).ready(function () { + $("a[data-toggle='tab']").on("shown.bs.tab", function() { + var url = $(this).prop("href"); + var hash = url.substring(url.indexOf("#") + 1); + + if (hash == "device_location") { + if (!map) { + loadLeafletMap(); + } + } + }); +}); \ 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.view/public/templates/applications-list.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/public/templates/applications-list.hbs new file mode 100644 index 000000000..3b55136af --- /dev/null +++ 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/templates/applications-list.hbs @@ -0,0 +1,31 @@ +
    +
    + {{#each applications}} + + {{#equal platform "android"}}{{/equal}} + {{#equal platform "ios"}}{{/equal}} + {{#equal platform "windows"}}{{/equal}} + {{#equal isActive true}} + + +  Active + + {{name}} + V:{{version}} + {{#if memoryUsage}} + + Memory Usage + + + ( {{memoryUsage}} Bytes ) + + {{/if}} + {{/equal}} + {{#equal isActive false}} + {{name}} + V:{{version}} + {{/equal}} + + {{/each}} +
    +
    \ 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.view/public/templates/operations-log.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/public/templates/operations-log.hbs new file mode 100644 index 000000000..cc5db5117 --- /dev/null +++ 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/templates/operations-log.hbs @@ -0,0 +1,24 @@ + + + + + + + + + + {{#each operations}} + + + + + + {{/each}} +
    + +
    Operation CodeStatusRequest created at
    {{code}} + {{#equal status "COMPLETED"}} Completed{{/equal}} + {{#equal status "PENDING"}} Pending{{/equal}} + {{#equal status "ERROR"}} Error{{/equal}} + {{#equal status "IN_PROGRESS"}} In Progress{{/equal}} + {{createdTimeStamp}}
    \ 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.view/public/templates/policy-compliance.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/public/templates/policy-compliance.hbs new file mode 100644 index 000000000..d20ca7a9c --- /dev/null +++ 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/templates/policy-compliance.hbs @@ -0,0 +1,79 @@ +
    + +
    +
    + + {{#equal deviceType "android"}} + + {{/equal}} + {{#equal deviceType "ios"}} + + {{/equal}} + {{#equal deviceType "windows"}} + + {{/equal}} + + +

    {{policy.policyName}}

    + {{deviceType}} +
    +
    +
    +
    +
    +
    + Ownership Type : {{policy.ownershipType}} +
    +
    +
    +
    + Compliance Type : {{policy.compliance}} +
    +
    +
    +
    + Compliance : + {{#equal compliance "COMPLIANT"}} + Compliant + {{/equal}} + {{#equal compliance "NON-COMPLIANT"}} + Not Compliant + {{/equal}} +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + + {{#each complianceFeatures}} + + + + + {{/each}} +
    + +
    FeatureCompliance
    {{featureCode}} + {{#equal compliance true}} Compliant{{/equal}} + {{#equal compliance false}} Not Compliant{{/equal}} +
    \ 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.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 new file mode 100644 index 000000000..1eb7f0e3c --- /dev/null +++ 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 @@ -0,0 +1,378 @@ +{{#zone "content"}} + {{#defineZone "device-detail-top"}} +
    +
    + +
    +
    + {{/defineZone}} +
    +
    +
    +
    +
    +
    +
    Device Overview
    + {{#defineZone "device-detail-properties"}} + + + + + + + {{#if device.viewModel.model}} + + + + + {{/if}} + + + + + {{#if device.viewModel.udid}} + + + + + {{/if}} + {{#if device.viewModel.os_build_date}} + + + + + {{/if}} + {{#if device.viewModel.phoneNumber}} + + + + + {{/if}} + + + + + +
    Device{{device.viewModel.vendor}} {{device.properties.model}}
    Model{{device.viewModel.model}}
    IMEI{{device.viewModel.imei}}
    UDID{{device.viewModel.udid}}
    Firmware Build Date{{device.viewModel.os_build_date}}
    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}} +
    + {{/defineZone}} +
    Operations
    +
    + {{unit "mdm.unit.device.operation-bar" deviceType=device.type}} +
    +
    +
    +
    + +
    + {{#defineZone "device-detail-properties"}} +
    +
    + + +
    + + +
    +

           Loading Device Details . . .
    +
    +
    + +
    +
    +
    + + + +
    +
    +
    + There is no active policy for this device. +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    + Device location cannot be retrieved. +
    +
    +
    +
    +
    + + +
    + +
    +
    +
    +

    + No applications found. please try refreshing the list in a while. +

    +

    +
    +
    +
    +
    +
    + + +
    + +
    +
    + There are no operations, performed yet on this device. +
    +
    +
    + + + + + + + + + + +
    Operation CodeStatusRequest created at
    +
    +
    +
    +
    +
    + {{/defineZone}} +
    +
    +{{/zone}} +{{#zone "bottomJs"}} + + + + {{js "js/device-detail.js"}} + + {{js "js/load-map.js"}} +{{/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/units/mdm.unit.device.view/view.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/view.js new file mode 100644 index 000000000..fe0d3a643 --- /dev/null +++ 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.js @@ -0,0 +1,102 @@ +/* + * 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. + */ + +function onRequest(context) { + var log = new Log("view.js"); + var deviceType = context.uriParams.deviceType; + var deviceId = request.getParameter("id"); + var deviceData = {}; + + if (deviceType && deviceId) { + var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; + var response = deviceModule.viewDevice(deviceType, deviceId); + if (response["status"] == "success") { + var device = response["content"]; + var viewModel = {}; + var deviceInfo = device["properties"]["DEVICE_INFO"]; + if (deviceInfo && String(deviceInfo.toString()).length > 0) { + deviceInfo = parse(stringify(deviceInfo)); + if (device["type"] == "ios") { + deviceInfo = parse(deviceInfo); + viewModel["imei"] = device["properties"]["IMEI"]; + viewModel["phoneNumber"] = deviceInfo["PhoneNumber"]; + viewModel["udid"] = deviceInfo["UDID"]; + viewModel["BatteryLevel"] = Math.round(deviceInfo["BatteryLevel"] * 100); + viewModel["DeviceCapacity"] = Math.round(deviceInfo["DeviceCapacity"] * 100) / 100; + viewModel["AvailableDeviceCapacity"] = Math. + round(deviceInfo["AvailableDeviceCapacity"] * 100) / 100; + viewModel["DeviceCapacityUsed"] = Math. + round((viewModel["DeviceCapacity"] - viewModel["AvailableDeviceCapacity"]) * 100) / 100; + viewModel["DeviceCapacityPercentage"] = Math. + round(viewModel["AvailableDeviceCapacity"] / viewModel["DeviceCapacity"] * 10000) / 100; + viewModel["location"] = { + latitude: device["properties"]["LATITUDE"], + longitude: device["properties"]["LONGITUDE"] + }; + } else if (device["type"] == "android") { + viewModel["imei"] = device["properties"]["IMEI"]; + viewModel["model"] = device["properties"]["DEVICE_MODEL"]; + viewModel["vendor"] = device["properties"]["VENDOR"]; + var osBuildDate = device["properties"]["OS_BUILD_DATE"]; + if (osBuildDate != null && osBuildDate != "0") { + var formattedDate = new Date(osBuildDate * 1000); + viewModel["os_build_date"] = formattedDate; + } + viewModel["internal_memory"] = {}; + viewModel["external_memory"] = {}; + viewModel["location"] = { + latitude: device["properties"]["LATITUDE"], + longitude: device["properties"]["LONGITUDE"] + }; + var info = {}; + var infoList = parse(deviceInfo); + if (infoList != null && infoList != undefined) { + for (var j = 0; j < infoList.length; j++) { + info[infoList[j].name] = infoList[j].value; + } + } + deviceInfo = info; + viewModel["BatteryLevel"] = deviceInfo["BATTERY_LEVEL"]; + viewModel["internal_memory"]["FreeCapacity"] = Math. + round(deviceInfo["INTERNAL_AVAILABLE_MEMORY"] * 100)/100; + viewModel["internal_memory"]["DeviceCapacityPercentage"] = Math. + round(deviceInfo["INTERNAL_AVAILABLE_MEMORY"] + / deviceInfo["INTERNAL_TOTAL_MEMORY"] * 10000) / 100; + viewModel["external_memory"]["FreeCapacity"] = Math. + round(deviceInfo["EXTERNAL_AVAILABLE_MEMORY"] * 100) / 100; + viewModel["external_memory"]["DeviceCapacityPercentage"] = Math. + round(deviceInfo["EXTERNAL_AVAILABLE_MEMORY"] + / deviceInfo["EXTERNAL_TOTAL_MEMORY"] * 10000) / 100; + } else if (device["type"] == "windows") { + viewModel["imei"] = device["properties"]["IMEI"]; + viewModel["model"] = device["properties"]["DEVICE_MODEL"]; + viewModel["vendor"] = device["properties"]["VENDOR"]; + viewModel["internal_memory"] = {}; + viewModel["external_memory"] = {}; + viewModel["location"] = { + latitude: device["properties"]["LATITUDE"], + longitude: device["properties"]["LONGITUDE"] + }; + } + device["viewModel"] = viewModel; + } + deviceData["device"] = device; + } + return deviceData; + } +} \ 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.view/view.json 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.json new file mode 100644 index 000000000..787e8b1dc --- /dev/null +++ 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.json @@ -0,0 +1,4 @@ +{ + "version": "1.0.0", + "extends": "cdmf.unit.device.view" +} \ No newline at end of file