Add Android global proxy policy UI components

Added UI components to create/edit and view global proxy settings.
revert-dabc3590
Madawa Soysa 6 years ago committed by Madawa Soysa
parent 61210bd73e
commit 2a959c39a7

@ -27,10 +27,11 @@
*
* 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];
};

@ -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"];

@ -56,6 +56,17 @@
<span id="wifi-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="wifi-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('global-proxy', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-proxy fw-stack-2x"></i>
</span>
Global Proxy Settings
<span id="global-proxy-configured" class="has-configured status-icon hidden">
<i class="fw fw-success"></i>
</span>
<span id="global-proxy-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="global-proxy-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('vpn', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-vpn fw-stack-2x"></i>
@ -950,6 +961,102 @@
</div>
<!-- /wi-fi -->
<!-- global-proxy -->
<div class="wr-hidden-operation" data-operation="global-proxy">
<div class="panel panel-default operation-data" data-operation="global-proxy" data-operation-code="GLOBAL_PROXY">
<div id="global-proxy-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Global Proxy Settings
<label class="wr-input-control switch" data-toggle="collapse" data-target="#global-proxy-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
<div class="panel-title-description">
<p>
This configurations can be used to set a network-independent global HTTP proxy on an Android
device. Once this configuration profile is installed on a device, all the network traffic
will be routed through the proxy server.
</p>
<p>
<b>This method requires the caller to be the device owner.</b>
</p>
<p>
This proxy is only a recommendation and it is possible that some apps will ignore it.
</p>
</div>
</div>
<div id="global-proxy-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="global-proxy-body">
<hr/>
Please note that * sign represents required fields of data.
<br>
<br>
<div id="global-proxy-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="proxy-host">
Proxy Host
<span class="helper required" title="Host name of the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-host" class="form-control operationDataKeys" data-key="proxyHost"/>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="proxy-port">
Proxy Port
<span class="helper required" title="The port which the proxy server is running.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<label id="proxyPortValidationText" class="wr-input-label hidden">
Port number should be between 0 - 65535
</label>
<input id="proxy-port" class="form-control operationDataKeys" data-key="proxyPort"
placeholder="[ Port number 0-65535 ]"/>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="proxy-excl">
Excluded List
<span class="helper"
title="Hosts to exclude using the proxy on connections for. These hosts can use
wildcards such as *.example.com.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList"
placeholder="[ Comma (,) separated list of proxy exclusions. These hosts can use
wildcards such as *.example.com. ]"/>
</div>
<div class="wr-input-control" id="control-proxy-username">
<label class="wr-input-label" for="proxy-username">
Username
<span class="helper" title="Username for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-username" class="form-control operationDataKeys"
data-key="proxyUsername" maxlength="50"/>
</div>
<div class="wr-input-control" id="control-proxy-password">
<label class="wr-input-label" for="proxy-password">
Password
<span class="helper" title="Password for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-password" type="password" class="form-control operationDataKeys"
data-key="proxyPassword" maxlength="100"/>
</div>
<!--</div>-->
</div>
</div>
</div>
<!-- /global-proxy -->
<!--app-restriction-->
<div class="wr-hidden-operation" data-operation="app-restriction">
<div class="panel panel-default operation-data" data-operation="app-restriction"

@ -39,6 +39,17 @@
<span id="wifi-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="wifi-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('global-proxy', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-proxy fw-stack-2x"></i>
</span>
Global Proxy Settings
<span id="global-proxy-configured" class="has-configured status-icon hidden">
<i class="fw fw-success"></i>
</span>
<span id="global-proxy-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="global-proxy-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('vpn', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-vpn fw-stack-2x"></i>
@ -955,6 +966,102 @@
</div>
<!-- /wi-fi -->
<!-- global-proxy -->
<div class="wr-hidden-operation" data-operation="global-proxy">
<div class="panel panel-default operation-data" data-operation="global-proxy" data-operation-code="GLOBAL_PROXY">
<div id="global-proxy-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Global Proxy Settings
<label class="wr-input-control switch" data-toggle="collapse" data-target="#global-proxy-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
<div class="panel-title-description">
<p>
This configurations can be used to set a network-independent global HTTP proxy on an Android
device. Once this configuration profile is installed on a device, all the network traffic
will be routed through the proxy server.
</p>
<p>
<b>This method requires the caller to be the device owner.</b>
</p>
<p>
This proxy is only a recommendation and it is possible that some apps will ignore it.
</p>
</div>
</div>
<div id="global-proxy-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="global-proxy-body">
<hr/>
Please note that * sign represents required fields of data.
<br>
<br>
<div id="global-proxy-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="proxy-host">
Proxy Host
<span class="helper required" title="Host name of the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-host" class="form-control operationDataKeys" data-key="proxyHost"/>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="proxy-port">
Proxy Port
<span class="helper required" title="The port which the proxy server is running.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<label id="proxyPortValidationText" class="wr-input-label hidden">
Port number should be between 0 - 65535
</label>
<input id="proxy-port" class="form-control operationDataKeys" data-key="proxyPort"
placeholder="[ Port number 0-65535 ]"/>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="proxy-excl">
Excluded List
<span class="helper"
title="Hosts to exclude using the proxy on connections for. These hosts can use
wildcards such as *.example.com.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList"
placeholder="[ Comma (,) separated list of proxy exclusions. These hosts can use
wildcards such as *.example.com. ]"/>
</div>
<div class="wr-input-control" id="control-proxy-username">
<label class="wr-input-label" for="proxy-username">
Username
<span class="helper" title="Username for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-username" class="form-control operationDataKeys"
data-key="proxyUsername" maxlength="50"/>
</div>
<div class="wr-input-control" id="control-proxy-password">
<label class="wr-input-label" for="proxy-password">
Password
<span class="helper" title="Password for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-password" type="password" class="form-control operationDataKeys"
data-key="proxyPassword" maxlength="100"/>
</div>
<!--</div>-->
</div>
</div>
</div>
<!-- /global-proxy -->
<!--COSU profile configuration-->
<div class="wr-hidden-operation" data-operation="cosu-profile-configuration">
<div class="panel panel-default operation-data" data-operation="cosu-profile-configuration"

@ -44,6 +44,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",
@ -242,6 +244,60 @@ 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
};
}
// updating validationStatusArray with validationStatus
validationStatusArray.push(validationStatus);
}
if ($.inArray(androidOperationConstants["VPN_OPERATION_CODE"], configuredOperations) != -1) {
// if WIFI is configured
operation = androidOperationConstants["VPN_OPERATION"];

@ -56,6 +56,17 @@
<span id="wifi-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="wifi-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('global-proxy', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-proxy fw-stack-2x"></i>
</span>
Global Proxy Settings
<span id="global-proxy-configured" class="has-configured status-icon hidden">
<i class="fw fw-success"></i>
</span>
<span id="global-proxy-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="global-proxy-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('vpn', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-vpn fw-stack-2x"></i>
@ -974,6 +985,102 @@
</div>
<!-- /wi-fi -->
<!-- global-proxy -->
<div class="wr-hidden-operation" data-operation="global-proxy">
<div class="panel panel-default operation-data" data-operation="global-proxy" data-operation-code="GLOBAL_PROXY">
<div id="global-proxy-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Global Proxy Settings
<label class="wr-input-control switch" data-toggle="collapse" data-target="#global-proxy-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
<div class="panel-title-description">
<p>
This configurations can be used to set a network-independent global HTTP proxy on an Android
device. Once this configuration profile is installed on a device, all the network traffic
will be routed through the proxy server.
</p>
<p>
<b>This method requires the caller to be the device owner.</b>
</p>
<p>
This proxy is only a recommendation and it is possible that some apps will ignore it.
</p>
</div>
</div>
<div id="global-proxy-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="global-proxy-body">
<hr/>
Please note that * sign represents required fields of data.
<br>
<br>
<div id="global-proxy-feature-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="proxy-host">
Proxy Host
<span class="helper required" title="Host name of the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-host" class="form-control operationDataKeys" data-key="proxyHost"/>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="proxy-port">
Proxy Port
<span class="helper required" title="The port which the proxy server is running.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<label id="proxyPortValidationText" class="wr-input-label hidden">
Port number should be between 0 - 65535
</label>
<input id="proxy-port" class="form-control operationDataKeys" data-key="proxyPort"
placeholder="[ Port number 0-65535 ]"/>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="proxy-excl">
Excluded List
<span class="helper"
title="Hosts to exclude using the proxy on connections for. These hosts can use
wildcards such as *.example.com.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList"
placeholder="[ Comma (,) separated list of proxy exclusions. These hosts can use
wildcards such as *.example.com. ]"/>
</div>
<div class="wr-input-control" id="control-proxy-username">
<label class="wr-input-label" for="proxy-username">
Username
<span class="helper" title="Username for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-username" class="form-control operationDataKeys"
data-key="proxyUsername" maxlength="50"/>
</div>
<div class="wr-input-control" id="control-proxy-password">
<label class="wr-input-label" for="proxy-password">
Password
<span class="helper" title="Password for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-password" type="password" class="form-control operationDataKeys"
data-key="proxyPassword" maxlength="100"/>
</div>
<!--</div>-->
</div>
</div>
</div>
<!-- /global-proxy -->
<!--app-restriction-->
<div class="wr-hidden-operation" data-operation="app-restriction">
<div class="panel panel-default operation-data" data-operation="app-restriction"

Loading…
Cancel
Save