Add always on VPN policy

merge-requests/42/head
Milan Perera 6 years ago committed by sandarudr
parent 582005f3f6
commit 3c368d94a6

@ -426,7 +426,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;

@ -174,7 +174,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"]:
@ -439,7 +440,8 @@ var androidOperationModule = function () {
payload = {
"operation": {
"type": operationData["type"],
"openvpn_config": operationData["openvpn_config"]
"openvpn_config": operationData["openvpn_config"],
"packageName": operationData["packageName"]
}
};
break;
@ -1251,4 +1253,4 @@ var androidOperationModule = function () {
};
return publicMethods;
}();
}();

@ -590,14 +590,34 @@ var validatePolicyProfile = function () {
// initializing continueToCheckNextInputs to true
continueToCheckNextInputs = true;
var openvpnConfig = $("#openvpn-config").val();
if (!openvpnConfig || openvpnConfig === '') {
validationStatus = {
"error": true,
"subErrorMsg": "ovpn config required. You cannot proceed.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
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 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
@ -1317,4 +1337,4 @@ $(document).ready(function () {
$(this).removeClass("child-input");
});
});
});
});

@ -1357,6 +1357,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 -->

@ -2246,6 +2246,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 -->
@ -2914,4 +2970,4 @@
<!--/enrolment-app-install-->
</div>
<script type="text/javascript">applyDataTable();</script>
</div>
</div>

@ -524,17 +524,35 @@ 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 = {
"error": true,
"subErrorMsg": "ovpn config file is required. You cannot proceed.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
}
var openvpnConfig = $("input#openvpn-config").val();
if (!openvpnConfig || openvpnConfig === '') {
validationStatus = {
"error": true,
"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
if (continueToCheckNextInputs) {
@ -1294,4 +1312,4 @@ $(document).ready(function () {
$(this).removeClass("child-input");
});
});
});
});

@ -2265,7 +2265,67 @@
<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 -->
@ -2868,4 +2928,4 @@
<!--/enrolment-app-install-->
</div>
<script type="text/javascript">applyDataTable();</script>
</div>
</div>

Loading…
Cancel
Save