mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 17:53:39 +00:00
Merge branch 'main' of github.com:bitwarden/clients
This commit is contained in:
@@ -27,8 +27,7 @@ export class UpdaterMain {
|
|||||||
process.platform === "win32" && !isWindowsStore() && !isWindowsPortable();
|
process.platform === "win32" && !isWindowsStore() && !isWindowsPortable();
|
||||||
const macCanUpdate = process.platform === "darwin" && !isMacAppStore();
|
const macCanUpdate = process.platform === "darwin" && !isMacAppStore();
|
||||||
this.canUpdate =
|
this.canUpdate =
|
||||||
process.env.ELECTRON_NO_UPDATER !== "1" &&
|
!this.userDisabledUpdates() && (linuxCanUpdate || windowsCanUpdate || macCanUpdate);
|
||||||
(linuxCanUpdate || windowsCanUpdate || macCanUpdate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
@@ -144,4 +143,13 @@ export class UpdaterMain {
|
|||||||
autoUpdater.autoDownload = true;
|
autoUpdater.autoDownload = true;
|
||||||
this.doingUpdateCheck = false;
|
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";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ describe("PolicyService", () => {
|
|||||||
organization("org4", true, true, OrganizationUserStatusType.Confirmed, false),
|
organization("org4", true, true, OrganizationUserStatusType.Confirmed, false),
|
||||||
// Another User
|
// Another User
|
||||||
organization("org5", true, true, OrganizationUserStatusType.Confirmed, false),
|
organization("org5", true, true, OrganizationUserStatusType.Confirmed, false),
|
||||||
|
// Can manage policies
|
||||||
|
organization("org6", true, true, OrganizationUserStatusType.Confirmed, true),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
policyService = new PolicyService(stateProvider, organizationService);
|
policyService = new PolicyService(stateProvider, organizationService);
|
||||||
@@ -254,6 +256,22 @@ describe("PolicyService", () => {
|
|||||||
expect(result).toBeNull();
|
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 () => {
|
it("does not return policies for organizations that do not use policies", async () => {
|
||||||
activeUserState.nextState(
|
activeUserState.nextState(
|
||||||
arrayToRecord([
|
arrayToRecord([
|
||||||
|
|||||||
@@ -232,6 +232,9 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
|||||||
case PolicyType.MaximumVaultTimeout:
|
case PolicyType.MaximumVaultTimeout:
|
||||||
// Max Vault Timeout applies to everyone except owners
|
// Max Vault Timeout applies to everyone except owners
|
||||||
return organization.isOwner;
|
return organization.isOwner;
|
||||||
|
case PolicyType.PasswordGenerator:
|
||||||
|
// password generation policy applies to everyone
|
||||||
|
return false;
|
||||||
default:
|
default:
|
||||||
return organization.canManagePolicies;
|
return organization.canManagePolicies;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user