mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-21 02:11:54 +01:00
Remove AddPolicyDefinitions feature flag (#12172)
This commit is contained in:
parent
a6c905cc1a
commit
853db233d9
@ -45,7 +45,7 @@ export abstract class BasePolicyComponent implements OnInit {
|
||||
return null;
|
||||
}
|
||||
|
||||
buildRequest(policiesEnabledMap: Map<PolicyType, boolean>) {
|
||||
buildRequest() {
|
||||
const request = new PolicyRequest();
|
||||
request.enabled = this.enabled.value;
|
||||
request.type = this.policy.type;
|
||||
|
@ -87,7 +87,6 @@ export class PoliciesComponent implements OnInit {
|
||||
data: {
|
||||
policy: policy,
|
||||
organizationId: this.organizationId,
|
||||
policiesEnabledMap: this.policiesEnabledMap,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -15,7 +15,6 @@ import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
||||
import { PolicyRequest } from "@bitwarden/common/admin-console/models/request/policy.request";
|
||||
import { PolicyResponse } from "@bitwarden/common/admin-console/models/response/policy.response";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
import { BasePolicy, BasePolicyComponent } from "../policies";
|
||||
@ -25,8 +24,6 @@ export type PolicyEditDialogData = {
|
||||
policy: BasePolicy;
|
||||
/** Returns a unique organization id */
|
||||
organizationId: string;
|
||||
/** A map indicating whether each policy type is enabled or disabled. */
|
||||
policiesEnabledMap: Map<PolicyType, boolean>;
|
||||
};
|
||||
|
||||
export enum PolicyEditDialogResult {
|
||||
@ -55,7 +52,6 @@ export class PolicyEditComponent implements AfterViewInit {
|
||||
@Inject(DIALOG_DATA) protected data: PolicyEditDialogData,
|
||||
private policyApiService: PolicyApiServiceAbstraction,
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private formBuilder: FormBuilder,
|
||||
private dialogRef: DialogRef<PolicyEditDialogResult>,
|
||||
@ -99,7 +95,7 @@ export class PolicyEditComponent implements AfterViewInit {
|
||||
submit = async () => {
|
||||
let request: PolicyRequest;
|
||||
try {
|
||||
request = await this.policyComponent.buildRequest(this.data.policiesEnabledMap);
|
||||
request = await this.policyComponent.buildRequest();
|
||||
} catch (e) {
|
||||
this.toastService.showToast({ variant: "error", title: null, message: e.message });
|
||||
return;
|
||||
|
@ -2,10 +2,6 @@ import { Component } from "@angular/core";
|
||||
|
||||
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 { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
|
||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||
|
||||
@ -24,25 +20,4 @@ export class RequireSsoPolicy extends BasePolicy {
|
||||
selector: "policy-require-sso",
|
||||
templateUrl: "require-sso.component.html",
|
||||
})
|
||||
export class RequireSsoPolicyComponent extends BasePolicyComponent {
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private configService: ConfigService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
async buildRequest(policiesEnabledMap: Map<PolicyType, boolean>): Promise<PolicyRequest> {
|
||||
if (await this.configService.getFeatureFlag(FeatureFlag.Pm13322AddPolicyDefinitions)) {
|
||||
// We are now relying on server-side validation only
|
||||
return super.buildRequest(policiesEnabledMap);
|
||||
}
|
||||
|
||||
const singleOrgEnabled = policiesEnabledMap.get(PolicyType.SingleOrg) ?? false;
|
||||
if (this.enabled.value && !singleOrgEnabled) {
|
||||
throw new Error(this.i18nService.t("requireSsoPolicyReqError"));
|
||||
}
|
||||
|
||||
return super.buildRequest(policiesEnabledMap);
|
||||
}
|
||||
}
|
||||
export class RequireSsoPolicyComponent extends BasePolicyComponent {}
|
||||
|
@ -2,10 +2,8 @@ import { Component, OnInit } from "@angular/core";
|
||||
import { firstValueFrom, Observable } from "rxjs";
|
||||
|
||||
import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
||||
import { PolicyRequest } from "@bitwarden/common/admin-console/models/request/policy.request";
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
|
||||
import { BasePolicy, BasePolicyComponent } from "./base-policy.component";
|
||||
|
||||
@ -21,10 +19,7 @@ export class SingleOrgPolicy extends BasePolicy {
|
||||
templateUrl: "single-org.component.html",
|
||||
})
|
||||
export class SingleOrgPolicyComponent extends BasePolicyComponent implements OnInit {
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private configService: ConfigService,
|
||||
) {
|
||||
constructor(private configService: ConfigService) {
|
||||
super();
|
||||
}
|
||||
|
||||
@ -44,39 +39,4 @@ export class SingleOrgPolicyComponent extends BasePolicyComponent implements OnI
|
||||
this.enabled.disable();
|
||||
}
|
||||
}
|
||||
|
||||
async buildRequest(policiesEnabledMap: Map<PolicyType, boolean>): Promise<PolicyRequest> {
|
||||
if (await this.configService.getFeatureFlag(FeatureFlag.Pm13322AddPolicyDefinitions)) {
|
||||
// We are now relying on server-side validation only
|
||||
return super.buildRequest(policiesEnabledMap);
|
||||
}
|
||||
|
||||
if (!this.enabled.value) {
|
||||
if (policiesEnabledMap.get(PolicyType.RequireSso) ?? false) {
|
||||
throw new Error(
|
||||
this.i18nService.t("disableRequiredError", this.i18nService.t("requireSso")),
|
||||
);
|
||||
}
|
||||
|
||||
if (policiesEnabledMap.get(PolicyType.MaximumVaultTimeout) ?? false) {
|
||||
throw new Error(
|
||||
this.i18nService.t(
|
||||
"disableRequiredError",
|
||||
this.i18nService.t("maximumVaultTimeoutLabel"),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
(await firstValueFrom(this.accountDeprovisioningEnabled$)) &&
|
||||
!this.policyResponse.canToggleState
|
||||
) {
|
||||
throw new Error(
|
||||
this.i18nService.t("disableRequiredError", this.i18nService.t("singleOrg")),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return super.buildRequest(policiesEnabledMap);
|
||||
}
|
||||
}
|
||||
|
@ -63,17 +63,12 @@ export class MaximumVaultTimeoutPolicyComponent extends BasePolicyComponent {
|
||||
};
|
||||
}
|
||||
|
||||
buildRequest(policiesEnabledMap: Map<PolicyType, boolean>): Promise<PolicyRequest> {
|
||||
const singleOrgEnabled = policiesEnabledMap.get(PolicyType.SingleOrg) ?? false;
|
||||
if (this.enabled.value && !singleOrgEnabled) {
|
||||
throw new Error(this.i18nService.t("requireSsoPolicyReqError"));
|
||||
}
|
||||
|
||||
const data = this.buildRequestData();
|
||||
if (data?.minutes == null || data?.minutes <= 0) {
|
||||
async buildRequest(): Promise<PolicyRequest> {
|
||||
const request = await super.buildRequest();
|
||||
if (request.data?.minutes == null || request.data?.minutes <= 0) {
|
||||
throw new Error(this.i18nService.t("invalidMaximumVaultTimeout"));
|
||||
}
|
||||
|
||||
return super.buildRequest(policiesEnabledMap);
|
||||
return request;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ export enum FeatureFlag {
|
||||
VerifiedSsoDomainEndpoint = "pm-12337-refactor-sso-details-endpoint",
|
||||
PM11901_RefactorSelfHostingLicenseUploader = "PM-11901-refactor-self-hosting-license-uploader",
|
||||
AccessIntelligence = "pm-13227-access-intelligence",
|
||||
Pm13322AddPolicyDefinitions = "pm-13322-add-policy-definitions",
|
||||
CriticalApps = "pm-14466-risk-insights-critical-application",
|
||||
TrialPaymentOptional = "PM-8163-trial-payment",
|
||||
SecurityTasks = "security-tasks",
|
||||
@ -82,7 +81,6 @@ export const DefaultFeatureFlagValue = {
|
||||
[FeatureFlag.VerifiedSsoDomainEndpoint]: FALSE,
|
||||
[FeatureFlag.PM11901_RefactorSelfHostingLicenseUploader]: FALSE,
|
||||
[FeatureFlag.AccessIntelligence]: FALSE,
|
||||
[FeatureFlag.Pm13322AddPolicyDefinitions]: FALSE,
|
||||
[FeatureFlag.CriticalApps]: FALSE,
|
||||
[FeatureFlag.TrialPaymentOptional]: FALSE,
|
||||
[FeatureFlag.SecurityTasks]: FALSE,
|
||||
|
Loading…
Reference in New Issue
Block a user