1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 13:23:34 +00:00

filter out restricted ciphers before filtering (#16403)

This commit is contained in:
Jordan Aasen
2025-09-16 09:02:32 -07:00
committed by GitHub
parent d06d47e26a
commit 4219a31f88

View File

@@ -66,6 +66,7 @@ import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-repromp
import { TreeNode } from "@bitwarden/common/vault/models/domain/tree-node";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { ServiceUtils } from "@bitwarden/common/vault/service-utils";
import { RestrictedItemTypesService } from "@bitwarden/common/vault/services/restricted-item-types.service";
import {
CipherViewLike,
CipherViewLikeUtils,
@@ -288,6 +289,7 @@ export class vNextVaultComponent implements OnInit, OnDestroy {
private billingNotificationService: BillingNotificationService,
private organizationWarningsService: OrganizationWarningsService,
private collectionService: CollectionService,
private restrictedItemTypesService: RestrictedItemTypesService,
) {
this.userId$ = this.accountService.activeAccount$.pipe(getUserId);
this.filter$ = this.routedVaultFilterService.filter$;
@@ -357,9 +359,10 @@ export class vNextVaultComponent implements OnInit, OnDestroy {
this.allCiphers$ = combineLatest([
this.organization$,
this.userId$,
this.restrictedItemTypesService.restricted$,
this.refreshingSubject$,
]).pipe(
switchMap(async ([organization, userId]) => {
switchMap(async ([organization, userId, restricted]) => {
// If user swaps organization reset the addAccessToggle
if (!this.showAddAccessToggle || organization) {
this.addAccessToggle(0);
@@ -381,6 +384,11 @@ export class vNextVaultComponent implements OnInit, OnDestroy {
ciphers = await this.cipherService.getManyFromApiForOrganization(organization.id);
}
// Filter out restricted ciphers before indexing
ciphers = ciphers.filter(
(cipher) => !this.restrictedItemTypesService.isCipherRestricted(cipher, restricted),
);
await this.searchService.indexCiphers(userId, ciphers, organization.id);
return ciphers;
}),