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

Commit 95778ffc authored by Nicolas Prevot's avatar Nicolas Prevot
Browse files

Fetch DISALLOW_CONFIG_VPN for the current user.

The code did not specify the user in which to fetch the value
of the restriction DISALLOW_CONFIG_VPN. Since it was called
from the vpn service which lives in user 0, it would always fetch
the value for user 0.

BUG: 18902920

Change-Id: I89419976a8edcaa86ac8e545c64d10818cd42ddd
parent d5fb9cac
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -488,7 +488,8 @@ 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)) {
            if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN,
                    new UserHandle(mUserHandle))) {
                throw new SecurityException("Restricted users cannot establish VPNs");
            }

@@ -896,7 +897,8 @@ public class Vpn {
        }
        UserManager mgr = UserManager.get(mContext);
        UserInfo user = mgr.getUserInfo(mUserHandle);
        if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
        if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN,
                    new UserHandle(mUserHandle))) {
            throw new SecurityException("Restricted users cannot establish VPNs");
        }