From 515c72abb0c80a6504973f584f7242591c5e8749 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Wed, 1 Sep 2021 07:11:28 +1000 Subject: [PATCH] Move policy checks within policyService (#2036) * Refactor: use policyService.policyAppliesToUser * Fix inverted condition * Update jslib --- jslib | 2 +- src/background/runtime.background.ts | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/jslib b/jslib index daa4f6f9a6d..30419a625fb 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit daa4f6f9a6dc84d6cd9a937be6b5392d2cf51eca +Subproject commit 30419a625fbdeefee1b0d0c24ee1d26064b17ba2 diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index e51e5c81618..4c47d837afc 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -456,18 +456,6 @@ export default class RuntimeBackground { } private async allowPersonalOwnership(): Promise { - const personalOwnershipPolicies = await this.policyService.getAll(PolicyType.PersonalOwnership); - if (personalOwnershipPolicies != null) { - for (const policy of personalOwnershipPolicies) { - if (policy.enabled) { - const org = await this.userService.getOrganization(policy.organizationId); - if (org != null && org.enabled && org.usePolicies && !org.canManagePolicies - && org.status === OrganizationUserStatusType.Confirmed) { - return false; - } - } - } - } - return true; + return !await this.policyService.policyAppliesToUser(PolicyType.PersonalOwnership); } }