From 91c2e305f19332c25e1514bfbb9c14bc0fc76e42 Mon Sep 17 00:00:00 2001 From: Cy Okeke Date: Wed, 6 Nov 2024 14:31:27 +0100 Subject: [PATCH] Add the new policy --- apps/web/src/locales/en/messages.json | 6 ++++++ .../bit-web/src/app/app.component.ts | 2 ++ .../bit-web/src/app/app.module.ts | 2 ++ .../free-families-sponsorship.component.html | 4 ++++ .../free-families-sponsorship.component.ts | 20 +++++++++++++++++++ .../admin-console/enums/policy-type.enum.ts | 1 + 6 files changed, 35 insertions(+) create mode 100644 bitwarden_license/bit-web/src/app/billing/policies/free-families-sponsorship.component.html create mode 100644 bitwarden_license/bit-web/src/app/billing/policies/free-families-sponsorship.component.ts diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 7e441ae4ba..d34c71757e 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -9580,5 +9580,11 @@ }, "organizationUserDeletedDesc": { "message": "The user was removed from the organization and all associated user data has been deleted." + }, + "freeFamiliesSponsorship": { + "message": "Remove Free Bitwarden Families sponsorship" + }, + "freeFamiliesSponsorshipPolicyDesc": { + "message": "Do not allow members to redeem a Families plan through this organization." } } diff --git a/bitwarden_license/bit-web/src/app/app.component.ts b/bitwarden_license/bit-web/src/app/app.component.ts index 9431e77e25..dd814f5c0d 100644 --- a/bitwarden_license/bit-web/src/app/app.component.ts +++ b/bitwarden_license/bit-web/src/app/app.component.ts @@ -7,6 +7,7 @@ import { ActivateAutofillPolicy } from "./admin-console/policies/activate-autofi import { AutomaticAppLoginPolicy } from "./admin-console/policies/automatic-app-login.component"; import { DisablePersonalVaultExportPolicy } from "./admin-console/policies/disable-personal-vault-export.component"; import { MaximumVaultTimeoutPolicy } from "./admin-console/policies/maximum-vault-timeout.component"; +import { FreeFamiliesSponsorshipPolicy } from "./billing/policies/free-families-sponsorship.component"; @Component({ selector: "app-root", @@ -19,6 +20,7 @@ export class AppComponent extends BaseAppComponent implements OnInit { this.policyListService.addPolicies([ new MaximumVaultTimeoutPolicy(), new DisablePersonalVaultExportPolicy(), + new FreeFamiliesSponsorshipPolicy(), new ActivateAutofillPolicy(), ]); diff --git a/bitwarden_license/bit-web/src/app/app.module.ts b/bitwarden_license/bit-web/src/app/app.module.ts index 8f2074262d..4db1e2f5e2 100644 --- a/bitwarden_license/bit-web/src/app/app.module.ts +++ b/bitwarden_license/bit-web/src/app/app.module.ts @@ -19,6 +19,7 @@ import { DisablePersonalVaultExportPolicyComponent } from "./admin-console/polic import { MaximumVaultTimeoutPolicyComponent } from "./admin-console/policies/maximum-vault-timeout.component"; import { AppRoutingModule } from "./app-routing.module"; import { AppComponent } from "./app.component"; +import { FreeFamiliesSponsorshipPolicyComponent } from "./billing/policies/free-families-sponsorship.component"; /** * This is the AppModule for the commercial version of Bitwarden. @@ -49,6 +50,7 @@ import { AppComponent } from "./app.component"; MaximumVaultTimeoutPolicyComponent, ActivateAutofillPolicyComponent, AutomaticAppLoginPolicyComponent, + FreeFamiliesSponsorshipPolicyComponent, ], bootstrap: [AppComponent], }) diff --git a/bitwarden_license/bit-web/src/app/billing/policies/free-families-sponsorship.component.html b/bitwarden_license/bit-web/src/app/billing/policies/free-families-sponsorship.component.html new file mode 100644 index 0000000000..b0dd1b688b --- /dev/null +++ b/bitwarden_license/bit-web/src/app/billing/policies/free-families-sponsorship.component.html @@ -0,0 +1,4 @@ + + + {{ "turnOn" | i18n }} + diff --git a/bitwarden_license/bit-web/src/app/billing/policies/free-families-sponsorship.component.ts b/bitwarden_license/bit-web/src/app/billing/policies/free-families-sponsorship.component.ts new file mode 100644 index 0000000000..521f865889 --- /dev/null +++ b/bitwarden_license/bit-web/src/app/billing/policies/free-families-sponsorship.component.ts @@ -0,0 +1,20 @@ +import { Component } from "@angular/core"; + +import { PolicyType } from "@bitwarden/common/admin-console/enums"; +import { + BasePolicy, + BasePolicyComponent, +} from "@bitwarden/web-vault/app/admin-console/organizations/policies/base-policy.component"; + +export class FreeFamiliesSponsorshipPolicy extends BasePolicy { + name = "freeFamiliesSponsorship"; + description = "freeFamiliesSponsorshipPolicyDesc"; + type = PolicyType.FreeFamiliesSponsorshipPolicy; + component = FreeFamiliesSponsorshipPolicyComponent; +} + +@Component({ + selector: "policy-personal-ownership", + templateUrl: "free-families-sponsorship.component.html", +}) +export class FreeFamiliesSponsorshipPolicyComponent extends BasePolicyComponent {} diff --git a/libs/common/src/admin-console/enums/policy-type.enum.ts b/libs/common/src/admin-console/enums/policy-type.enum.ts index b05a03bb92..2ca9fbef8d 100644 --- a/libs/common/src/admin-console/enums/policy-type.enum.ts +++ b/libs/common/src/admin-console/enums/policy-type.enum.ts @@ -12,4 +12,5 @@ export enum PolicyType { DisablePersonalVaultExport = 10, // Disable personal vault export ActivateAutofill = 11, // Activates autofill with page load on the browser extension AutomaticAppLogIn = 12, // Enables automatic log in of apps from configured identity provider + FreeFamiliesSponsorshipPolicy = 13, // Disables free families plan for organization }