diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index cc3985fb390..15e7d3cc341 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -884,7 +884,6 @@ export default class MainBackground { ); this.restrictedItemTypesService = new RestrictedItemTypesService( - this.configService, this.accountService, this.organizationService, this.policyService, diff --git a/apps/cli/src/service-container/service-container.ts b/apps/cli/src/service-container/service-container.ts index 1e0aa1b15fe..4413df4abc5 100644 --- a/apps/cli/src/service-container/service-container.ts +++ b/apps/cli/src/service-container/service-container.ts @@ -689,7 +689,6 @@ export class ServiceContainer { ); this.restrictedItemTypesService = new RestrictedItemTypesService( - this.configService, this.accountService, this.organizationService, this.policyService, diff --git a/apps/web/src/app/admin-console/organizations/policies/policy-edit-definitions/restricted-item-types.component.ts b/apps/web/src/app/admin-console/organizations/policies/policy-edit-definitions/restricted-item-types.component.ts index 51cba689693..8f2573f0da3 100644 --- a/apps/web/src/app/admin-console/organizations/policies/policy-edit-definitions/restricted-item-types.component.ts +++ b/apps/web/src/app/admin-console/organizations/policies/policy-edit-definitions/restricted-item-types.component.ts @@ -1,10 +1,6 @@ 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 { SharedModule } from "../../../../shared"; import { BasePolicyEditDefinition, BasePolicyEditComponent } from "../base-policy-edit.component"; @@ -14,10 +10,6 @@ export class RestrictedItemTypesPolicy extends BasePolicyEditDefinition { description = "restrictedItemTypePolicyDesc"; type = PolicyType.RestrictedItemTypes; component = RestrictedItemTypesPolicyComponent; - - display$(organization: Organization, configService: ConfigService): Observable { - return configService.getFeatureFlag$(FeatureFlag.RemoveCardItemTypePolicy); - } } @Component({ diff --git a/libs/angular/src/services/jslib-services.module.ts b/libs/angular/src/services/jslib-services.module.ts index d08b4b17c25..b51e8847ffd 100644 --- a/libs/angular/src/services/jslib-services.module.ts +++ b/libs/angular/src/services/jslib-services.module.ts @@ -692,7 +692,7 @@ const safeProviders: SafeProvider[] = [ safeProvider({ provide: RestrictedItemTypesService, useClass: RestrictedItemTypesService, - deps: [ConfigService, AccountService, OrganizationServiceAbstraction, PolicyServiceAbstraction], + deps: [AccountService, OrganizationServiceAbstraction, PolicyServiceAbstraction], }), safeProvider({ provide: PasswordStrengthServiceAbstraction, diff --git a/libs/common/src/enums/feature-flag.enum.ts b/libs/common/src/enums/feature-flag.enum.ts index e5f2b9bf48a..90c6669e5bc 100644 --- a/libs/common/src/enums/feature-flag.enum.ts +++ b/libs/common/src/enums/feature-flag.enum.ts @@ -48,7 +48,6 @@ export enum FeatureFlag { PM22134SdkCipherListView = "pm-22134-sdk-cipher-list-view", PM22136_SdkCipherEncryption = "pm-22136-sdk-cipher-encryption", CipherKeyEncryption = "cipher-key-encryption", - RemoveCardItemTypePolicy = "pm-16442-remove-card-item-type-policy", /* Platform */ IpcChannelFramework = "ipc-channel-framework", @@ -90,7 +89,6 @@ export const DefaultFeatureFlagValue = { /* Vault */ [FeatureFlag.CipherKeyEncryption]: FALSE, [FeatureFlag.PM19941MigrateCipherDomainToSdk]: FALSE, - [FeatureFlag.RemoveCardItemTypePolicy]: FALSE, [FeatureFlag.PM22134SdkCipherListView]: FALSE, [FeatureFlag.PM22136_SdkCipherEncryption]: FALSE, diff --git a/libs/common/src/vault/services/restricted-item-types.service.spec.ts b/libs/common/src/vault/services/restricted-item-types.service.spec.ts index f412de08046..3ae68d47c5c 100644 --- a/libs/common/src/vault/services/restricted-item-types.service.spec.ts +++ b/libs/common/src/vault/services/restricted-item-types.service.spec.ts @@ -52,12 +52,7 @@ describe("RestrictedItemTypesService", () => { organizationService.organizations$.mockReturnValue(of([org1, org2])); policyService.policiesByType$.mockReturnValue(of([])); - service = new RestrictedItemTypesService( - configService, - accountService, - organizationService, - policyService, - ); + service = new RestrictedItemTypesService(accountService, organizationService, policyService); }); it("emits empty array when feature flag is disabled", async () => { diff --git a/libs/common/src/vault/services/restricted-item-types.service.ts b/libs/common/src/vault/services/restricted-item-types.service.ts index 206bc9e2cb7..9e0c0c78510 100644 --- a/libs/common/src/vault/services/restricted-item-types.service.ts +++ b/libs/common/src/vault/services/restricted-item-types.service.ts @@ -6,8 +6,6 @@ import { PolicyService } from "@bitwarden/common/admin-console/abstractions/poli import { PolicyType } from "@bitwarden/common/admin-console/enums"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { getOptionalUserId } from "@bitwarden/common/auth/services/account.service"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { CipherType } from "@bitwarden/common/vault/enums"; import { uuidAsString } from "../../platform/abstractions/sdk/sdk.service"; @@ -25,51 +23,43 @@ export class RestrictedItemTypesService { * - cipherType: each type restricted by at least one org-level policy * - allowViewOrgIds: org IDs that allow viewing that type */ - readonly restricted$: Observable = this.configService - .getFeatureFlag$(FeatureFlag.RemoveCardItemTypePolicy) - .pipe( - switchMap((flagOn) => { - if (!flagOn) { - return of([]); + readonly restricted$: Observable = + this.accountService.activeAccount$.pipe( + getOptionalUserId, + switchMap((userId) => { + if (userId == null) { + return of([]); // No user logged in, no restrictions } - return this.accountService.activeAccount$.pipe( - getOptionalUserId, - switchMap((userId) => { - if (userId == null) { - return of([]); // No user logged in, no restrictions - } - return combineLatest([ - this.organizationService.organizations$(userId), - this.policyService.policiesByType$(PolicyType.RestrictedItemTypes, userId), - ]).pipe( - map(([orgs, enabledPolicies]) => { - // Helper to extract restricted types, defaulting to [Card] - const restrictedTypes = (p: (typeof enabledPolicies)[number]) => - (p.data as CipherType[]) ?? [CipherType.Card]; + return combineLatest([ + this.organizationService.organizations$(userId), + this.policyService.policiesByType$(PolicyType.RestrictedItemTypes, userId), + ]).pipe( + map(([orgs, enabledPolicies]) => { + // Helper to extract restricted types, defaulting to [Card] + const restrictedTypes = (p: (typeof enabledPolicies)[number]) => + (p.data as CipherType[]) ?? [CipherType.Card]; - // Union across all enabled policies - const allRestrictedTypes = Array.from( - new Set(enabledPolicies.flatMap(restrictedTypes)), - ); - - return allRestrictedTypes.map((cipherType) => { - // Determine which orgs allow viewing this type - const allowViewOrgIds = orgs - .filter((org) => { - const orgPolicy = enabledPolicies.find((p) => p.organizationId === org.id); - // no policy for this org => allows everything - if (!orgPolicy) { - return true; - } - // if this type not in their restricted list => they allow it - return !restrictedTypes(orgPolicy).includes(cipherType); - }) - .map((org) => org.id); - - return { cipherType, allowViewOrgIds }; - }); - }), + // Union across all enabled policies + const allRestrictedTypes = Array.from( + new Set(enabledPolicies.flatMap(restrictedTypes)), ); + + return allRestrictedTypes.map((cipherType) => { + // Determine which orgs allow viewing this type + const allowViewOrgIds = orgs + .filter((org) => { + const orgPolicy = enabledPolicies.find((p) => p.organizationId === org.id); + // no policy for this org => allows everything + if (!orgPolicy) { + return true; + } + // if this type not in their restricted list => they allow it + return !restrictedTypes(orgPolicy).includes(cipherType); + }) + .map((org) => org.id); + + return { cipherType, allowViewOrgIds }; + }); }), ); }), @@ -78,7 +68,6 @@ export class RestrictedItemTypesService { ); constructor( - private configService: ConfigService, private accountService: AccountService, private organizationService: OrganizationService, private policyService: PolicyService,