Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 628ae0d8 authored by Robin Lee's avatar Robin Lee
Browse files

Move VPN restriction check into setup dialog

The purpose of DISALLOW_CONFIG_VPN is to stop users from configuring
VPN, not from using it at all.

The key difference being that if the admin already enforced a VPN then
that setting should be respected (but it still shouldn't be tamperable).

Bug: 28733079
Change-Id: Ib8cab5657a9d5819a019093da3812cd8c2ca4050
parent 005f9a73
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
import android.text.Html;
import android.text.Html.ImageGetter;
import android.util.Log;
@@ -55,6 +56,10 @@ public class ConfirmDialog extends AlertActivity
            finish();
            return;
        }
        if (UserManager.get(this).hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
            finish();
            return;
        }
        View view = View.inflate(this, R.layout.confirm, null);
        ((TextView) view.findViewById(R.id.warning)).setText(
                Html.fromHtml(getString(R.string.warning, getVpnLabel()),
+1 −2
Original line number Diff line number Diff line
@@ -555,8 +555,7 @@ public class Vpn {
        try {
            // Restricted users are not allowed to create VPNs, they are tied to Owner
            UserInfo user = mgr.getUserInfo(mUserHandle);
            if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN,
                    new UserHandle(mUserHandle))) {
            if (user.isRestricted()) {
                throw new SecurityException("Restricted users cannot establish VPNs");
            }