From c2b91d2d46c0d31aef46559643063765b575a85a Mon Sep 17 00:00:00 2001 From: SmithThe4th Date: Thu, 11 Apr 2024 17:53:16 +0100 Subject: [PATCH 1/3] [PM-4700] Fixed issue with clearing search index state (#8686) * fixed issue with clearing search index state * Decrease snap description character length to reach 128 limit (#8687) * clear user index before account is totally cleaned up * [AC-2436] Fix flashing unassigned items banner (#8689) * Fix flashing banner for users who shouldn't see it * Emit the right value the first time * simplify further * restore comment * added logout clear on option * removed redundant clear index from logout --------- Co-authored-by: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> --- apps/browser/src/background/main.background.ts | 5 ----- apps/desktop/src/app/app.component.ts | 1 - libs/common/src/services/search.service.ts | 6 +++--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index bbcb9f96287..0e43f420abc 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -1181,13 +1181,8 @@ export default class MainBackground { //Needs to be checked before state is cleaned const needStorageReseed = await this.needsStorageReseed(); - const currentUserId = await this.stateService.getUserId(); const newActiveUser = await this.stateService.clean({ userId: userId }); - if (userId == null || userId === currentUserId) { - await this.searchService.clearIndex(); - } - await this.stateEventRunnerService.handleEvent("logout", userId); if (newActiveUser != null) { diff --git a/apps/desktop/src/app/app.component.ts b/apps/desktop/src/app/app.component.ts index 257921e2ad6..b2b44e6b217 100644 --- a/apps/desktop/src/app/app.component.ts +++ b/apps/desktop/src/app/app.component.ts @@ -609,7 +609,6 @@ export class AppComponent implements OnInit, OnDestroy { // This must come last otherwise the logout will prematurely trigger // a process reload before all the state service user data can be cleaned up if (userBeingLoggedOut === preLogoutActiveUserId) { - await this.searchService.clearIndex(); this.authService.logOut(async () => { if (expired) { this.platformUtilsService.showToast( diff --git a/libs/common/src/services/search.service.ts b/libs/common/src/services/search.service.ts index 429992b0760..38ddfe0e472 100644 --- a/libs/common/src/services/search.service.ts +++ b/libs/common/src/services/search.service.ts @@ -35,7 +35,7 @@ export const LUNR_SEARCH_INDEX = new UserKeyDefinition( "searchIndex", { deserializer: (obj: Jsonify) => obj, - clearOn: ["lock"], + clearOn: ["lock", "logout"], }, ); @@ -48,7 +48,7 @@ export const LUNR_SEARCH_INDEXED_ENTITY_ID = new UserKeyDefinition) => obj, - clearOn: ["lock"], + clearOn: ["lock", "logout"], }, ); @@ -61,7 +61,7 @@ export const LUNR_SEARCH_INDEXING = new UserKeyDefinition( "isIndexing", { deserializer: (obj: Jsonify) => obj, - clearOn: ["lock"], + clearOn: ["lock", "logout"], }, ); From 787ad64b737a8c9f77cade966369d1d38e75987b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Audrey=20=E2=9C=A8?= Date: Thu, 11 Apr 2024 13:32:50 -0400 Subject: [PATCH 2/3] apply password generator policy to all users (#8641) --- .../services/policy/policy.service.spec.ts | 18 ++++++++++++++++++ .../services/policy/policy.service.ts | 3 +++ 2 files changed, 21 insertions(+) diff --git a/libs/common/src/admin-console/services/policy/policy.service.spec.ts b/libs/common/src/admin-console/services/policy/policy.service.spec.ts index a1633d29ff2..b67ef4619f3 100644 --- a/libs/common/src/admin-console/services/policy/policy.service.spec.ts +++ b/libs/common/src/admin-console/services/policy/policy.service.spec.ts @@ -50,6 +50,8 @@ describe("PolicyService", () => { organization("org4", true, true, OrganizationUserStatusType.Confirmed, false), // Another User organization("org5", true, true, OrganizationUserStatusType.Confirmed, false), + // Can manage policies + organization("org6", true, true, OrganizationUserStatusType.Confirmed, true), ]); policyService = new PolicyService(stateProvider, organizationService); @@ -254,6 +256,22 @@ describe("PolicyService", () => { expect(result).toBeNull(); }); + it.each([ + ["owners", "org2"], + ["administrators", "org6"], + ])("returns the password generator policy for %s", async (_, organization) => { + activeUserState.nextState( + arrayToRecord([ + policyData("policy1", "org1", PolicyType.ActivateAutofill, false), + policyData("policy2", organization, PolicyType.PasswordGenerator, true), + ]), + ); + + const result = await firstValueFrom(policyService.get$(PolicyType.PasswordGenerator)); + + expect(result).toBeTruthy(); + }); + it("does not return policies for organizations that do not use policies", async () => { activeUserState.nextState( arrayToRecord([ diff --git a/libs/common/src/admin-console/services/policy/policy.service.ts b/libs/common/src/admin-console/services/policy/policy.service.ts index 0cbc7204de0..a093dad61a9 100644 --- a/libs/common/src/admin-console/services/policy/policy.service.ts +++ b/libs/common/src/admin-console/services/policy/policy.service.ts @@ -232,6 +232,9 @@ export class PolicyService implements InternalPolicyServiceAbstraction { case PolicyType.MaximumVaultTimeout: // Max Vault Timeout applies to everyone except owners return organization.isOwner; + case PolicyType.PasswordGenerator: + // password generation policy applies to everyone + return false; default: return organization.canManagePolicies; } From 59392418d1fc72fe2a662846039e63d738c2d1ca Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 11 Apr 2024 14:14:56 -0400 Subject: [PATCH 3/3] [PM-7280] Check command args for disabled updater (#8613) * dont autoupdate on older OS and with args * remove os release checking * use dashes --- apps/desktop/src/main/updater.main.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/main/updater.main.ts b/apps/desktop/src/main/updater.main.ts index c9a2dc0e145..0e2efa66f91 100644 --- a/apps/desktop/src/main/updater.main.ts +++ b/apps/desktop/src/main/updater.main.ts @@ -27,8 +27,7 @@ export class UpdaterMain { process.platform === "win32" && !isWindowsStore() && !isWindowsPortable(); const macCanUpdate = process.platform === "darwin" && !isMacAppStore(); this.canUpdate = - process.env.ELECTRON_NO_UPDATER !== "1" && - (linuxCanUpdate || windowsCanUpdate || macCanUpdate); + !this.userDisabledUpdates() && (linuxCanUpdate || windowsCanUpdate || macCanUpdate); } async init() { @@ -144,4 +143,13 @@ export class UpdaterMain { autoUpdater.autoDownload = true; this.doingUpdateCheck = false; } + + private userDisabledUpdates(): boolean { + for (const arg of process.argv) { + if (arg != null && arg.toUpperCase().indexOf("--ELECTRON_NO_UPDATER=1") > -1) { + return true; + } + } + return process.env.ELECTRON_NO_UPDATER === "1"; + } }