From 29e16fc5e04e96dd0c0471aa1e9f324eceff5a4d Mon Sep 17 00:00:00 2001 From: Brandon Treston Date: Wed, 6 Aug 2025 09:34:43 -0400 Subject: [PATCH] [PM-22107] Update Remove Individual Vault policy dialog (#15323) * WIP * switch to signal * fix ts strict errors * clean up * refactor policy list service * implement vnext component * refactor to include feature flag check in display() * CR feedback * refactor submit to cancel before request is built * clean up * Fix typo --------- Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> --- .../policies/base-policy.component.ts | 46 ++++++++++----- .../organizations/policies/index.ts | 1 + .../organization-data-ownership.component.ts | 10 ++++ .../policies/policies.component.html | 59 +++++++++++-------- .../policies/policies.component.ts | 43 ++++++-------- .../policies/policy-edit.component.html | 4 +- .../policies/policy-edit.component.ts | 7 +++ .../policies/require-sso.component.ts | 6 +- .../policies/reset-password.component.ts | 11 +++- .../restricted-item-types.component.ts | 8 +++ .../policies/single-org.component.ts | 3 + ...organization-data-ownership.component.html | 57 ++++++++++++++++++ ...t-organization-data-ownership.component.ts | 50 ++++++++++++++++ apps/web/src/app/app.component.ts | 4 ++ apps/web/src/locales/en/messages.json | 31 ++++++++++ .../policies/activate-autofill.component.ts | 6 +- .../models/request/policy.request.ts | 6 +- 17 files changed, 276 insertions(+), 76 deletions(-) create mode 100644 apps/web/src/app/admin-console/organizations/policies/vnext-organization-data-ownership.component.html create mode 100644 apps/web/src/app/admin-console/organizations/policies/vnext-organization-data-ownership.component.ts diff --git a/apps/web/src/app/admin-console/organizations/policies/base-policy.component.ts b/apps/web/src/app/admin-console/organizations/policies/base-policy.component.ts index 01c45264236..3af99644dd2 100644 --- a/apps/web/src/app/admin-console/organizations/policies/base-policy.component.ts +++ b/apps/web/src/app/admin-console/organizations/policies/base-policy.component.ts @@ -1,12 +1,12 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { Directive, Input, OnInit } from "@angular/core"; import { UntypedFormControl, UntypedFormGroup } from "@angular/forms"; +import { Observable, of } from "rxjs"; import { PolicyType } from "@bitwarden/common/admin-console/enums"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { PolicyRequest } from "@bitwarden/common/admin-console/models/request/policy.request"; import { PolicyResponse } from "@bitwarden/common/admin-console/models/response/policy.response"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; export abstract class BasePolicy { abstract name: string; @@ -14,38 +14,56 @@ export abstract class BasePolicy { abstract type: PolicyType; abstract component: any; - display(organization: Organization) { - return true; + /** + * If true, the description will be reused in the policy edit modal. Set this to false if you + * have more complex requirements that you will implement in your template instead. + **/ + showDescription: boolean = true; + + display(organization: Organization, configService: ConfigService): Observable { + return of(true); } } @Directive() export abstract class BasePolicyComponent implements OnInit { - @Input() policyResponse: PolicyResponse; - @Input() policy: BasePolicy; + @Input() policyResponse: PolicyResponse | undefined; + @Input() policy: BasePolicy | undefined; enabled = new UntypedFormControl(false); - data: UntypedFormGroup = null; + data: UntypedFormGroup | undefined; ngOnInit(): void { - this.enabled.setValue(this.policyResponse.enabled); + this.enabled.setValue(this.policyResponse?.enabled); - if (this.policyResponse.data != null) { + if (this.policyResponse?.data != null) { this.loadData(); } } buildRequest() { - const request = new PolicyRequest(); - request.enabled = this.enabled.value; - request.type = this.policy.type; - request.data = this.buildRequestData(); + if (!this.policy) { + throw new Error("Policy was not found"); + } + + const request: PolicyRequest = { + type: this.policy.type, + enabled: this.enabled.value, + data: this.buildRequestData(), + }; return Promise.resolve(request); } + /** + * Enable optional validation before sumitting a respose for policy submission + * */ + confirm(): Promise | boolean { + return true; + } + protected loadData() { - this.data.patchValue(this.policyResponse.data ?? {}); + this.data?.patchValue(this.policyResponse?.data ?? {}); } protected buildRequestData() { diff --git a/apps/web/src/app/admin-console/organizations/policies/index.ts b/apps/web/src/app/admin-console/organizations/policies/index.ts index 828aa8230fa..6b6b2303b2f 100644 --- a/apps/web/src/app/admin-console/organizations/policies/index.ts +++ b/apps/web/src/app/admin-console/organizations/policies/index.ts @@ -3,6 +3,7 @@ export { BasePolicy, BasePolicyComponent } from "./base-policy.component"; export { DisableSendPolicy } from "./disable-send.component"; export { MasterPasswordPolicy } from "./master-password.component"; export { PasswordGeneratorPolicy } from "./password-generator.component"; +export { vNextOrganizationDataOwnershipPolicy } from "./vnext-organization-data-ownership.component"; export { OrganizationDataOwnershipPolicy } from "./organization-data-ownership.component"; export { RequireSsoPolicy } from "./require-sso.component"; export { ResetPasswordPolicy } from "./reset-password.component"; diff --git a/apps/web/src/app/admin-console/organizations/policies/organization-data-ownership.component.ts b/apps/web/src/app/admin-console/organizations/policies/organization-data-ownership.component.ts index 1c1710f7662..beb9fd5752a 100644 --- a/apps/web/src/app/admin-console/organizations/policies/organization-data-ownership.component.ts +++ b/apps/web/src/app/admin-console/organizations/policies/organization-data-ownership.component.ts @@ -1,6 +1,10 @@ import { Component } from "@angular/core"; +import { map, Observable } from "rxjs"; import { PolicyType } from "@bitwarden/common/admin-console/enums"; +import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; +import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { BasePolicy, BasePolicyComponent } from "./base-policy.component"; @@ -9,6 +13,12 @@ export class OrganizationDataOwnershipPolicy extends BasePolicy { description = "personalOwnershipPolicyDesc"; type = PolicyType.OrganizationDataOwnership; component = OrganizationDataOwnershipPolicyComponent; + + display(organization: Organization, configService: ConfigService): Observable { + return configService + .getFeatureFlag$(FeatureFlag.CreateDefaultLocation) + .pipe(map((enabled) => !enabled)); + } } @Component({ diff --git a/apps/web/src/app/admin-console/organizations/policies/policies.component.html b/apps/web/src/app/admin-console/organizations/policies/policies.component.html index 016d631019e..8eb204b65a4 100644 --- a/apps/web/src/app/admin-console/organizations/policies/policies.component.html +++ b/apps/web/src/app/admin-console/organizations/policies/policies.component.html @@ -1,38 +1,45 @@ @let organization = organization$ | async; - + @if (isBreadcrumbingEnabled$ | async) { + + } - + @if (loading) { {{ "loading" | i18n }} - - - - - - - {{ - "on" | i18n - }} - {{ p.description | i18n }} - - - - + } + @if (!loading) { + + + @for (p of policies; track p.name) { + @if (p.display(organization, configService) | async) { + + + + @if (policiesEnabledMap.get(p.type)) { + {{ "on" | i18n }} + } + {{ p.description | i18n }} + + + } + } + + + } diff --git a/apps/web/src/app/admin-console/organizations/policies/policies.component.ts b/apps/web/src/app/admin-console/organizations/policies/policies.component.ts index 8b6894871bd..3dfc4cc0c20 100644 --- a/apps/web/src/app/admin-console/organizations/policies/policies.component.ts +++ b/apps/web/src/app/admin-console/organizations/policies/policies.component.ts @@ -15,7 +15,6 @@ import { Organization } from "@bitwarden/common/admin-console/models/domain/orga import { PolicyResponse } from "@bitwarden/common/admin-console/models/response/policy.response"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { OrganizationBillingServiceAbstraction } from "@bitwarden/common/billing/abstractions"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { DialogService } from "@bitwarden/components"; import { @@ -25,7 +24,7 @@ import { import { All } from "@bitwarden/web-vault/app/vault/individual-vault/vault-filter/shared/models/routed-vault-filter.model"; import { PolicyListService } from "../../core/policy-list.service"; -import { BasePolicy, RestrictedItemTypesPolicy } from "../policies"; +import { BasePolicy } from "../policies"; import { CollectionDialogTabType } from "../shared/components/collection-dialog"; import { PolicyEditComponent, PolicyEditDialogResult } from "./policy-edit.component"; @@ -53,7 +52,7 @@ export class PoliciesComponent implements OnInit { private policyListService: PolicyListService, private organizationBillingService: OrganizationBillingServiceAbstraction, private dialogService: DialogService, - private configService: ConfigService, + protected configService: ConfigService, ) {} async ngOnInit() { @@ -71,35 +70,31 @@ export class PoliciesComponent implements OnInit { await this.load(); // Handle policies component launch from Event message - /* eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe */ - this.route.queryParams.pipe(first()).subscribe(async (qParams) => { - if (qParams.policyId != null) { - const policyIdFromEvents: string = qParams.policyId; - for (const orgPolicy of this.orgPolicies) { - if (orgPolicy.id === policyIdFromEvents) { - for (let i = 0; i < this.policies.length; i++) { - if (this.policies[i].type === orgPolicy.type) { - // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.edit(this.policies[i]); - break; + this.route.queryParams + .pipe(first()) + /* eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe, rxjs/no-nested-subscribe */ + .subscribe(async (qParams) => { + if (qParams.policyId != null) { + const policyIdFromEvents: string = qParams.policyId; + for (const orgPolicy of this.orgPolicies) { + if (orgPolicy.id === policyIdFromEvents) { + for (let i = 0; i < this.policies.length; i++) { + if (this.policies[i].type === orgPolicy.type) { + // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this.edit(this.policies[i]); + break; + } } + break; } - break; } } - } - }); + }); }); } async load() { - if ( - (await this.configService.getFeatureFlag(FeatureFlag.RemoveCardItemTypePolicy)) && - this.policyListService.getPolicies().every((p) => !(p instanceof RestrictedItemTypesPolicy)) - ) { - this.policyListService.addPolicies([new RestrictedItemTypesPolicy()]); - } const response = await this.policyApiService.getPolicies(this.organizationId); this.orgPolicies = response.data != null && response.data.length > 0 ? response.data : []; this.orgPolicies.forEach((op) => { diff --git a/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.html b/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.html index 7f33f08f888..90cfb52e5ad 100644 --- a/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.html +++ b/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.html @@ -22,7 +22,9 @@ {{ "loading" | i18n }}
-

{{ policy.description | i18n }}

+ @if (policy.showDescription) { +

{{ policy.description | i18n }}

+ }
diff --git a/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.ts b/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.ts index d3d03d2aaae..2984db67d39 100644 --- a/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.ts +++ b/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.ts @@ -128,13 +128,20 @@ export class PolicyEditComponent implements AfterViewInit { } submit = async () => { + if ((await this.policyComponent.confirm()) == false) { + this.dialogRef.close(); + return; + } + let request: PolicyRequest; + try { request = await this.policyComponent.buildRequest(); } catch (e) { this.toastService.showToast({ variant: "error", title: null, message: e.message }); return; } + await this.policyApiService.putPolicy(this.data.organizationId, this.data.policy.type, request); this.toastService.showToast({ variant: "success", diff --git a/apps/web/src/app/admin-console/organizations/policies/require-sso.component.ts b/apps/web/src/app/admin-console/organizations/policies/require-sso.component.ts index 21de143dea6..3a0d196c593 100644 --- a/apps/web/src/app/admin-console/organizations/policies/require-sso.component.ts +++ b/apps/web/src/app/admin-console/organizations/policies/require-sso.component.ts @@ -1,7 +1,9 @@ import { Component } from "@angular/core"; +import { of } from "rxjs"; import { PolicyType } from "@bitwarden/common/admin-console/enums"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { BasePolicy, BasePolicyComponent } from "./base-policy.component"; @@ -11,8 +13,8 @@ export class RequireSsoPolicy extends BasePolicy { type = PolicyType.RequireSso; component = RequireSsoPolicyComponent; - display(organization: Organization) { - return organization.useSso; + display(organization: Organization, configService: ConfigService) { + return of(organization.useSso); } } diff --git a/apps/web/src/app/admin-console/organizations/policies/reset-password.component.ts b/apps/web/src/app/admin-console/organizations/policies/reset-password.component.ts index 62fc42f6a06..93a42285fbc 100644 --- a/apps/web/src/app/admin-console/organizations/policies/reset-password.component.ts +++ b/apps/web/src/app/admin-console/organizations/policies/reset-password.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from "@angular/core"; import { FormBuilder } from "@angular/forms"; -import { firstValueFrom } from "rxjs"; +import { firstValueFrom, of } from "rxjs"; import { getOrganizationById, @@ -10,6 +10,7 @@ import { PolicyType } from "@bitwarden/common/admin-console/enums"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { getUserId } from "@bitwarden/common/auth/services/account.service"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { BasePolicy, BasePolicyComponent } from "./base-policy.component"; @@ -19,8 +20,8 @@ export class ResetPasswordPolicy extends BasePolicy { type = PolicyType.ResetPassword; component = ResetPasswordPolicyComponent; - display(organization: Organization) { - return organization.useResetPassword; + display(organization: Organization, configService: ConfigService) { + return of(organization.useResetPassword); } } @@ -52,6 +53,10 @@ export class ResetPasswordPolicyComponent extends BasePolicyComponent implements throw new Error("No user found."); } + if (!this.policyResponse) { + throw new Error("Policies not found"); + } + const organization = await firstValueFrom( this.organizationService .organizations$(userId) diff --git a/apps/web/src/app/admin-console/organizations/policies/restricted-item-types.component.ts b/apps/web/src/app/admin-console/organizations/policies/restricted-item-types.component.ts index 1bee5583718..6cad0fc0170 100644 --- a/apps/web/src/app/admin-console/organizations/policies/restricted-item-types.component.ts +++ b/apps/web/src/app/admin-console/organizations/policies/restricted-item-types.component.ts @@ -1,6 +1,10 @@ import { Component } from "@angular/core"; +import { Observable } from "rxjs"; import { PolicyType } from "@bitwarden/common/admin-console/enums"; +import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; +import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { BasePolicy, BasePolicyComponent } from "./base-policy.component"; @@ -9,6 +13,10 @@ export class RestrictedItemTypesPolicy extends BasePolicy { description = "restrictedItemTypePolicyDesc"; type = PolicyType.RestrictedItemTypes; component = RestrictedItemTypesPolicyComponent; + + display(organization: Organization, configService: ConfigService): Observable { + return configService.getFeatureFlag$(FeatureFlag.RemoveCardItemTypePolicy); + } } @Component({ diff --git a/apps/web/src/app/admin-console/organizations/policies/single-org.component.ts b/apps/web/src/app/admin-console/organizations/policies/single-org.component.ts index ad32b4218bc..613253ef8d9 100644 --- a/apps/web/src/app/admin-console/organizations/policies/single-org.component.ts +++ b/apps/web/src/app/admin-console/organizations/policies/single-org.component.ts @@ -20,6 +20,9 @@ export class SingleOrgPolicyComponent extends BasePolicyComponent implements OnI async ngOnInit() { super.ngOnInit(); + if (!this.policyResponse) { + throw new Error("Policies not found"); + } if (!this.policyResponse.canToggleState) { this.enabled.disable(); } diff --git a/apps/web/src/app/admin-console/organizations/policies/vnext-organization-data-ownership.component.html b/apps/web/src/app/admin-console/organizations/policies/vnext-organization-data-ownership.component.html new file mode 100644 index 00000000000..0abc40da683 --- /dev/null +++ b/apps/web/src/app/admin-console/organizations/policies/vnext-organization-data-ownership.component.html @@ -0,0 +1,57 @@ +

+ {{ "organizationDataOwnershipContent" | i18n }} + + {{ "organizationDataOwnershipContentAnchor" | i18n }}. + +

+ + + + {{ "turnOn" | i18n }} + + + + + {{ "organizationDataOwnershipWarningTitle" | i18n }} + +
+ {{ "organizationDataOwnershipWarningContentTop" | i18n }} +
+
    +
  • + {{ "organizationDataOwnershipWarning1" | i18n }} +
  • +
  • + {{ "organizationDataOwnershipWarning2" | i18n }} +
  • +
  • + {{ "organizationDataOwnershipWarning3" | i18n }} +
  • +
+
+ {{ "organizationDataOwnershipWarningContentBottom" | i18n }} + + {{ "organizationDataOwnershipContentAnchor" | i18n }}. + +
+
+ + + + + + +
+
diff --git a/apps/web/src/app/admin-console/organizations/policies/vnext-organization-data-ownership.component.ts b/apps/web/src/app/admin-console/organizations/policies/vnext-organization-data-ownership.component.ts new file mode 100644 index 00000000000..11b1548d9f9 --- /dev/null +++ b/apps/web/src/app/admin-console/organizations/policies/vnext-organization-data-ownership.component.ts @@ -0,0 +1,50 @@ +import { Component, OnInit, TemplateRef, ViewChild } from "@angular/core"; +import { lastValueFrom, Observable } from "rxjs"; + +import { PolicyType } from "@bitwarden/common/admin-console/enums"; +import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; +import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; +import { DialogService } from "@bitwarden/components"; + +import { SharedModule } from "../../../shared"; + +import { BasePolicy, BasePolicyComponent } from "./base-policy.component"; + +export class vNextOrganizationDataOwnershipPolicy extends BasePolicy { + name = "organizationDataOwnership"; + description = "organizationDataOwnershipDesc"; + type = PolicyType.OrganizationDataOwnership; + component = vNextOrganizationDataOwnershipPolicyComponent; + showDescription = false; + + override display(organization: Organization, configService: ConfigService): Observable { + return configService.getFeatureFlag$(FeatureFlag.CreateDefaultLocation); + } +} + +@Component({ + selector: "vnext-policy-organization-data-ownership", + templateUrl: "vnext-organization-data-ownership.component.html", + standalone: true, + imports: [SharedModule], +}) +export class vNextOrganizationDataOwnershipPolicyComponent + extends BasePolicyComponent + implements OnInit +{ + constructor(private dialogService: DialogService) { + super(); + } + + @ViewChild("dialog", { static: true }) warningContent!: TemplateRef; + + override async confirm(): Promise { + if (this.policyResponse?.enabled && !this.enabled.value) { + const dialogRef = this.dialogService.open(this.warningContent); + const result = await lastValueFrom(dialogRef.closed); + return Boolean(result); + } + return true; + } +} diff --git a/apps/web/src/app/app.component.ts b/apps/web/src/app/app.component.ts index ceb2c788e75..694d0c6eb9a 100644 --- a/apps/web/src/app/app.component.ts +++ b/apps/web/src/app/app.component.ts @@ -35,12 +35,14 @@ import { MasterPasswordPolicy, PasswordGeneratorPolicy, OrganizationDataOwnershipPolicy, + vNextOrganizationDataOwnershipPolicy, RequireSsoPolicy, ResetPasswordPolicy, SendOptionsPolicy, SingleOrgPolicy, TwoFactorAuthenticationPolicy, RemoveUnlockWithPinPolicy, + RestrictedItemTypesPolicy, } from "./admin-console/organizations/policies"; const BroadcasterSubscriptionId = "AppComponent"; @@ -244,8 +246,10 @@ export class AppComponent implements OnDestroy, OnInit { new SingleOrgPolicy(), new RequireSsoPolicy(), new OrganizationDataOwnershipPolicy(), + new vNextOrganizationDataOwnershipPolicy(), new DisableSendPolicy(), new SendOptionsPolicy(), + new RestrictedItemTypesPolicy(), ]); } diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 62f73fd4935..edcc153bcf4 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -5429,6 +5429,37 @@ "organizationDataOwnership": { "message": "Enforce organization data ownership" }, + "organizationDataOwnershipDesc": { + "message": "Require all items to be owned by an organization, removing the option to store items at the account level.", + "description": "This is the policy description shown in the policy list." + }, + "organizationDataOwnershipContent": { + "message": "All items will be owned and saved to the organization, enabling organization-wide controls, visibility, and reporting. When turned on, a default collection be available for each member to store items. Learn more about managing the ", + "description": "This will be used as part of a larger sentence, broken up to include links. The full sentence will read 'All items will be owned and saved to the organization, enabling organization-wide controls, visibility, and reporting. When turned on, a default collection be available for each member to store items. Learn more about managing the credential lifecycle.'" + }, + "organizationDataOwnershipContentAnchor":{ + "message": "credential lifecycle", + "description": "This will be used as a hyperlink" + }, + "organizationDataOwnershipWarningTitle":{ + "message": "Are you sure you want to proceed?" + }, + "organizationDataOwnershipWarning1":{ + "message": "will remain accessible to members" + }, + "organizationDataOwnershipWarning2":{ + "message": "will not be automatically selected when creating new items" + }, + "organizationDataOwnershipWarning3":{ + "message": "cannot be managed from the Admin Console until the user is offboarded" + }, + "organizationDataOwnershipWarningContentTop":{ + "message": "By turning this policy off, the default collection: " + }, + "organizationDataOwnershipWarningContentBottom":{ + "message": "Learn more about the ", + "description": "This will be used as part of a larger sentence, broken up to include links. The full sentence will read 'Learn more about the credential lifecycle.'" + }, "personalOwnership": { "message": "Remove individual vault" }, diff --git a/bitwarden_license/bit-web/src/app/admin-console/policies/activate-autofill.component.ts b/bitwarden_license/bit-web/src/app/admin-console/policies/activate-autofill.component.ts index 61e2133d059..821509b43e2 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/policies/activate-autofill.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/policies/activate-autofill.component.ts @@ -1,7 +1,9 @@ import { Component } from "@angular/core"; +import { of } from "rxjs"; import { PolicyType } from "@bitwarden/common/admin-console/enums"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { BasePolicy, BasePolicyComponent, @@ -13,8 +15,8 @@ export class ActivateAutofillPolicy extends BasePolicy { type = PolicyType.ActivateAutofill; component = ActivateAutofillPolicyComponent; - display(organization: Organization) { - return organization.useActivateAutofillPolicy; + display(organization: Organization, configService: ConfigService) { + return of(organization.useActivateAutofillPolicy); } } diff --git a/libs/common/src/admin-console/models/request/policy.request.ts b/libs/common/src/admin-console/models/request/policy.request.ts index 0f3b1be7d88..7b2e4f76063 100644 --- a/libs/common/src/admin-console/models/request/policy.request.ts +++ b/libs/common/src/admin-console/models/request/policy.request.ts @@ -1,9 +1,7 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { PolicyType } from "../../enums"; -export class PolicyRequest { +export type PolicyRequest = { type: PolicyType; enabled: boolean; data: any; -} +};