1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 22:03:36 +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 { TreeNode } from "@bitwarden/common/vault/models/domain/tree-node";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { ServiceUtils } from "@bitwarden/common/vault/service-utils"; import { ServiceUtils } from "@bitwarden/common/vault/service-utils";
import { RestrictedItemTypesService } from "@bitwarden/common/vault/services/restricted-item-types.service";
import { import {
CipherViewLike, CipherViewLike,
CipherViewLikeUtils, CipherViewLikeUtils,
@@ -288,6 +289,7 @@ export class vNextVaultComponent implements OnInit, OnDestroy {
private billingNotificationService: BillingNotificationService, private billingNotificationService: BillingNotificationService,
private organizationWarningsService: OrganizationWarningsService, private organizationWarningsService: OrganizationWarningsService,
private collectionService: CollectionService, private collectionService: CollectionService,
private restrictedItemTypesService: RestrictedItemTypesService,
) { ) {
this.userId$ = this.accountService.activeAccount$.pipe(getUserId); this.userId$ = this.accountService.activeAccount$.pipe(getUserId);
this.filter$ = this.routedVaultFilterService.filter$; this.filter$ = this.routedVaultFilterService.filter$;
@@ -357,9 +359,10 @@ export class vNextVaultComponent implements OnInit, OnDestroy {
this.allCiphers$ = combineLatest([ this.allCiphers$ = combineLatest([
this.organization$, this.organization$,
this.userId$, this.userId$,
this.restrictedItemTypesService.restricted$,
this.refreshingSubject$, this.refreshingSubject$,
]).pipe( ]).pipe(
switchMap(async ([organization, userId]) => { switchMap(async ([organization, userId, restricted]) => {
// If user swaps organization reset the addAccessToggle // If user swaps organization reset the addAccessToggle
if (!this.showAddAccessToggle || organization) { if (!this.showAddAccessToggle || organization) {
this.addAccessToggle(0); this.addAccessToggle(0);
@@ -381,6 +384,11 @@ export class vNextVaultComponent implements OnInit, OnDestroy {
ciphers = await this.cipherService.getManyFromApiForOrganization(organization.id); 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); await this.searchService.indexCiphers(userId, ciphers, organization.id);
return ciphers; return ciphers;
}), }),