diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js index 4b510a3040..2612025654 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js @@ -23,14 +23,15 @@ * 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. + * */ var androidOperationModule = function () { @@ -51,6 +52,7 @@ var androidOperationModule = function () { "CAMERA_OPERATION_CODE": "CAMERA", "ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE", "WIFI_OPERATION_CODE": "WIFI", + "GLOBAL_PROXY_OPERATION_CODE": "GLOBAL_PROXY", "WIPE_OPERATION_CODE": "WIPE_DATA", "NOTIFICATION_OPERATION_CODE": "NOTIFICATION", "WORK_PROFILE_CODE": "WORK_PROFILE", @@ -153,6 +155,15 @@ var androidOperationModule = function () { "wifiCaCertName": operationPayload["cacertName"] }; break; + case androidOperationConstants["GLOBAL_PROXY_OPERATION_CODE"]: + payload = { + "proxyHost": operationPayload["proxyHost"], + "proxyPort": operationPayload["proxyPort"], + "proxyExclList": operationPayload["proxyExclList"], + "proxyUsername": operationPayload["proxyUsername"], + "proxyPassword": operationPayload["proxyPassword"] + }; + break; case androidOperationConstants["VPN_OPERATION_CODE"]: payload = { "serverAddress": operationPayload["serverAddress"], @@ -310,6 +321,22 @@ var androidOperationModule = function () { } }; break; + case androidOperationConstants["GLOBAL_PROXY_OPERATION_CODE"]: + operationType = operationTypeConstants["PROFILE"]; + var proxyExclList = []; + if (operationData["proxyExclList"]) { + proxyExclList = operationData["proxyExclList"].trim().split(/\s*,\s*/); + } + payload = { + "operation": { + "proxyHost": operationData["proxyHost"], + "proxyPort": operationData["proxyPort"], + "proxyExclList": proxyExclList, + "proxyUsername": operationData["proxyUsername"], + "proxyPassword": operationData["proxyPassword"] + } + }; + break; case androidOperationConstants["VPN_OPERATION_CODE"]: operationType = operationTypeConstants["PROFILE"]; payload = { @@ -433,6 +460,7 @@ var androidOperationModule = function () { publicMethods.getAndroidServiceEndpoint = function (operationCode) { var featureMap = { "WIFI": "configure-wifi", + "GLOBAL_PROXY": "set-global-proxy", "CAMERA": "control-camera", "VPN": "configure-vpn", "DEVICE_LOCK": "lock-devices", @@ -455,7 +483,6 @@ var androidOperationModule = function () { "ENTERPRISE_WIPE": "enterprise-wipe", "WIPE_DATA": "wipe" }; - //return "/mdm-android-agent/operation/" + featureMap[operationCode]; return "/api/device-mgt/android/v1.0/admin/devices/" + featureMap[operationCode]; }; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js index cc151761f9..63f26628be 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js @@ -45,6 +45,8 @@ var androidOperationConstants = { "ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE", "WIFI_OPERATION": "wifi", "WIFI_OPERATION_CODE": "WIFI", + "GLOBAL_PROXY_OPERATION": "global-proxy", + "GLOBAL_PROXY_OPERATION_CODE": "GLOBAL_PROXY", "VPN_OPERATION": "vpn", "VPN_OPERATION_CODE": "VPN", "APPLICATION_OPERATION": "app-restriction", @@ -323,6 +325,57 @@ var validatePolicyProfile = function () { validationStatusArray.push(validationStatus); } + // Validating PROXY + if ($.inArray(androidOperationConstants["GLOBAL_PROXY_OPERATION_CODE"], configuredOperations) !== -1) { + // if PROXY is configured + operation = androidOperationConstants["GLOBAL_PROXY_OPERATION"]; + // initializing continueToCheckNextInputs to true + continueToCheckNextInputs = true; + + var proxyHost = $("input#proxy-host").val(); + var proxyPort = $("input#proxy-port").val(); + if (!proxyHost) { + validationStatus = { + "error": true, + "subErrorMsg": "Proxy server host name is required.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + + if (!proxyPort) { + validationStatus = { + "error": true, + "subErrorMsg": "Proxy server port is required.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } else if (!$.isNumeric(proxyPort)) { + validationStatus = { + "error": true, + "subErrorMsg": "Proxy server port requires a number input.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } else if (!inputIsValidAgainstRange(proxyPort, 0, 65535)) { + validationStatus = { + "error": true, + "subErrorMsg": "Proxy server port is not within the range of valid port numbers.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + + // at-last, if the value of continueToCheckNextInputs is still true + // this means that no error is found + if (continueToCheckNextInputs) { + validationStatus = { + "error": false, + "okFeature": operation + }; + } + } + if ($.inArray(androidOperationConstants["VPN_OPERATION_CODE"], configuredOperations) != -1) { // if WIFI is configured operation = androidOperationConstants["VPN_OPERATION"]; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs index 82f09727be..e6771b2077 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs @@ -56,6 +56,17 @@ + + + + + Global Proxy Settings + + + + @@ -950,6 +961,102 @@ + +
+
+ +
+
+ Please note that * sign represents required fields of data. +
+
+ +
+ + +
+
+ + + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ +
+ + + + + Global Proxy Settings + + + + @@ -955,6 +966,102 @@
+ +
+
+ +
+
+ Please note that * sign represents required fields of data. +
+
+ +
+ + +
+
+ + + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ +
+ +
+
+ +
+
+ Please note that * sign represents required fields of data. +
+
+ +
+ + +
+
+ + + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+ +