Merge branch 'force-vpn' into 'master'

Add always on VPN policy

See merge request entgra/carbon-device-mgt-plugins!41
revert-dabc3590
Inosh Perara 6 years ago
commit fcd69d6ec4

@ -418,7 +418,8 @@ var generatePayload = function (operationCode, operationData, deviceList) {
payload = {
"operation": {
"type": operationData["type"],
"openvpn_config": operationData["openvpn_config"]
"openvpn_config": operationData["openvpn_config"],
"packageName": operationData["packageName"]
}
};
break;

@ -167,7 +167,8 @@ var androidOperationModule = function () {
case androidOperationConstants["VPN_OPERATION_CODE"]:
payload = {
"type": operationPayload["type"],
"openvpn_config": operationPayload["openvpn_config"]
"openvpn_config": operationPayload["openvpn_config"],
"packageName": operationPayload["packageName"]
};
break;
case androidOperationConstants["APPLICATION_OPERATION_CODE"]:
@ -425,7 +426,8 @@ var androidOperationModule = function () {
payload = {
"operation": {
"type": operationData["type"],
"openvpn_config": operationData["openvpn_config"]
"openvpn_config": operationData["openvpn_config"],
"packageName": operationData["packageName"]
}
};
break;

@ -590,15 +590,35 @@ var validatePolicyProfile = function () {
// initializing continueToCheckNextInputs to true
continueToCheckNextInputs = true;
var openvpnConfig = $("#openvpn-config").val();
let openVpnConfigEnabled = document.getElementById('vpn-body').classList.contains('in');
if (openVpnConfigEnabled) {
var openvpnConfig = $("textarea#openvpn-config").val();
if (!openvpnConfig || openvpnConfig === '') {
validationStatus = {
"error": true,
"subErrorMsg": "ovpn config required. You cannot proceed.",
"subErrorMsg": "ovpn config file is required. You cannot proceed.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
}
if (validationStatus) {
validationStatusArray.push(validationStatus);
}
let alwaysOnVpnEnabled = document.getElementById('always-on-vpn-body').classList.contains('in');
if (alwaysOnVpnEnabled) {
var alwaysOnConfig = $("input#vpn-client-app").val();
if (!alwaysOnConfig || alwaysOnConfig === '') {
validationStatus = {
"error": true,
"subErrorMsg": "Add a valid package name for the VPN client",
"erroneousFeature": "always-on-vpn"
};
continueToCheckNextInputs = false;
}
}
// at-last, if the value of continueToCheckNextInputs is still true
// this means that no error is found

@ -1246,6 +1246,62 @@
<input id="vpn-type" class="form-control operationDataKeys" type="hidden" data-key="type" value="OpenVPN" />
</div>
</div>
<!-- Always on VPN connection settings -->
<div id="always-on-vpn-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Always On VPN Settings
<label class="wr-input-control switch" data-toggle="collapse" data-target="#always-on-vpn-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
<div class="panel-title-description">
Configure an always-on VPN connection through a specific VPN client application
</div>
</div>
<div id="always-on-vpn-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="vpn-body">
<hr/>
<div class="always-on-vpn-message">
<ul class="message message-info">
<i class="icon fw fw-info"></i>
<a id="always-on-vpn-status-msg"> Below configurations are valid only when the Agent is
<b>work-profile owner</b> or <b>device owner</b>.</a>
</ul>
</div>
<br/>
<div class="wr-input-control">
<label class="wr-input-label" for="vpn-client-app">
VPN Client Application Package Name*
<span class="helper" title="Package name of the VPN client application to be configured.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="vpn-client-app" type="text" class="form-control operationDataKeys"
data-key="packageName" maxlength="200" placeholder="[ Should be a valid package name ]"/>
</div>
<!--<div class="wr-input-control">-->
<!--<label class="wr-input-control checkbox">-->
<!--<input id="vpn-lock-down" type="checkbox" class="operationDataKeys"-->
<!--data-key="lockDownEnable" checked="checked"/>-->
<!--<span class="helper"-->
<!--title="True to disallow networking when the VPN is not connected or false otherwise">-->
<!--Lock Down VPN-->
<!--<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>-->
<!--</span>-->
<!--</label>-->
<!--</div>-->
</div>
<!-- Always on VPN connection settings -->
</div>
</div>
<!-- /VPN -->

@ -2142,6 +2142,62 @@
data-key="openvpn_config" style="height: 400px;" disabled></textarea>
</div>
</div>
<!-- Always on VPN connection settings -->
<div id="always-on-vpn-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Always On VPN Settings
<label class="wr-input-control switch" data-toggle="collapse" data-target="#always-on-vpn-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
<div class="panel-title-description">
Configure an always-on VPN connection through a specific VPN client application
</div>
</div>
<div id="always-on-vpn-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="vpn-body">
<hr/>
<div class="always-on-vpn-message">
<ul class="message message-info">
<i class="icon fw fw-info"></i>
<a id="always-on-vpn-status-msg"> Below configurations are valid only when the Agent is
<b>work-profile owner</b> or <b>device owner</b>.</a>
</ul>
</div>
<br/>
<div class="wr-input-control">
<label class="wr-input-label" for="vpn-client-app">
VPN Client Application Package Name
<span class="helper" title="Package name of the VPN client application to be configured.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="vpn-client-app" type="text" class="form-control operationDataKeys"
data-key="packageName" maxlength="200" placeholder="[ Should be a valid package name ]"/>
</div>
<!--<div class="wr-input-control">-->
<!--<label class="wr-input-control checkbox">-->
<!--<input id="vpn-lock-down" type="checkbox" class="operationDataKeys"-->
<!--data-key="lockDownEnable" checked="checked"/>-->
<!--<span class="helper"-->
<!--title="True to disallow networking when the VPN is not connected or false otherwise">-->
<!--Lock Down VPN-->
<!--<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>-->
<!--</span>-->
<!--</label>-->
<!--</div>-->
</div>
<!-- Always on VPN connection settings -->
</div>
</div>
<!-- /VPN -->

@ -524,7 +524,8 @@ var validatePolicyProfile = function () {
operation = androidOperationConstants["VPN_OPERATION"];
// initializing continueToCheckNextInputs to true
continueToCheckNextInputs = true;
let openVpnConfigEnabled = document.getElementById('vpn-body').classList.contains('in');
if (openVpnConfigEnabled) {
var openvpnConfig = $("input#openvpn-config").val();
if (!openvpnConfig || openvpnConfig === '') {
validationStatus = {
@ -534,7 +535,24 @@ var validatePolicyProfile = function () {
};
continueToCheckNextInputs = false;
}
}
if (validationStatus) {
validationStatusArray.push(validationStatus);
}
let alwaysOnVpnEnabled = document.getElementById('always-on-vpn-body').classList.contains('in');
if (alwaysOnVpnEnabled) {
var alwaysOnConfig = $("input#vpn-client-app").val();
if (!alwaysOnConfig || alwaysOnConfig === '') {
validationStatus = {
"error": true,
"subErrorMsg": "Add a valid package name for the VPN client",
"erroneousFeature": "always-on-vpn"
};
continueToCheckNextInputs = false;
}
}
// at-last, if the value of continueToCheckNextInputs is still true
// this means that no error is found
if (continueToCheckNextInputs) {

@ -2160,8 +2160,68 @@
<input id="openvpn-config" class="form-control operationDataKeys" type="hidden" data-key="openvpn_config" />
<input id="vpn-type" class="form-control operationDataKeys" type="hidden" data-key="type" value="OpenVPN" />
</div>
<br/>
</div>
<!-- Always on VPN connection settings -->
<div id="always-on-vpn-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Always On VPN Settings
<label class="wr-input-control switch" data-toggle="collapse" data-target="#always-on-vpn-body">
<input type="checkbox"/>
<span class="helper"></span>
<span class="text"></span>
</label>
</h2>
<div class="panel-title-description">
Configure an always-on VPN connection through a specific VPN client application
</div>
</div>
<div id="always-on-vpn-body" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="vpn-body">
<hr/>
<div class="always-on-vpn-message">
<ul class="message message-info">
<i class="icon fw fw-info"></i>
<a id="always-on-vpn-status-msg"> Below configurations are valid only when the Agent is
<b>work-profile owner</b> or <b>device owner</b>.</a>
</ul>
</div>
<br/>
<div id="always-on-vpn-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="vpn-client-app">
VPN Client Application Package Name
<span class="helper" title="Package name of the VPN client application to be configured.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="vpn-client-app" type="text" class="form-control operationDataKeys"
data-key="packageName" maxlength="200" placeholder="[ Should be a valid package name ]"/>
</div>
<!--<div class="wr-input-control">-->
<!--<label class="wr-input-control checkbox">-->
<!--<input id="vpn-lock-down" type="checkbox" class="operationDataKeys"-->
<!--data-key="lockDownEnable" checked="checked"/>-->
<!--<span class="helper"-->
<!--title="True to disallow networking when the VPN is not connected or false otherwise">-->
<!--Lock Down VPN-->
<!--<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>-->
<!--</span>-->
<!--</label>-->
<!--</div>-->
</div>
<!-- Always on VPN connection settings -->
</div>
</div>
<!-- /VPN -->

Loading…
Cancel
Save