mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
apply password generator policy to all users (#8641)
This commit is contained in:
parent
c2b91d2d46
commit
787ad64b73
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user