From 81e9015b5b7ecbc38b50bbf3a0fb3420ea5c402d Mon Sep 17 00:00:00 2001 From: Tom <144813356+ttalty@users.noreply.github.com> Date: Thu, 23 Oct 2025 12:54:52 -0400 Subject: [PATCH] Adding include my items to the services and reports (#16987) --- .../exposed-passwords-report.component.ts | 2 +- .../reused-passwords-report.component.ts | 2 +- .../unsecured-websites-report.component.ts | 2 +- .../weak-passwords-report.component.ts | 2 +- libs/common/src/abstractions/api.service.ts | 5 ++++- libs/common/src/services/api.service.ts | 17 +++++++++-------- .../src/vault/abstractions/cipher.service.ts | 5 ++++- .../common/src/vault/services/cipher.service.ts | 10 ++++++++-- 8 files changed, 29 insertions(+), 16 deletions(-) diff --git a/apps/web/src/app/dirt/reports/pages/organizations/exposed-passwords-report.component.ts b/apps/web/src/app/dirt/reports/pages/organizations/exposed-passwords-report.component.ts index b88987e1d2..e7392ad609 100644 --- a/apps/web/src/app/dirt/reports/pages/organizations/exposed-passwords-report.component.ts +++ b/apps/web/src/app/dirt/reports/pages/organizations/exposed-passwords-report.component.ts @@ -86,7 +86,7 @@ export class ExposedPasswordsReportComponent } getAllCiphers(): Promise { - return this.cipherService.getAllFromApiForOrganization(this.organization.id); + return this.cipherService.getAllFromApiForOrganization(this.organization.id, true); } canManageCipher(c: CipherView): boolean { diff --git a/apps/web/src/app/dirt/reports/pages/organizations/reused-passwords-report.component.ts b/apps/web/src/app/dirt/reports/pages/organizations/reused-passwords-report.component.ts index 7fcf356243..5c48919510 100644 --- a/apps/web/src/app/dirt/reports/pages/organizations/reused-passwords-report.component.ts +++ b/apps/web/src/app/dirt/reports/pages/organizations/reused-passwords-report.component.ts @@ -84,7 +84,7 @@ export class ReusedPasswordsReportComponent } getAllCiphers(): Promise { - return this.cipherService.getAllFromApiForOrganization(this.organization.id); + return this.cipherService.getAllFromApiForOrganization(this.organization.id, true); } canManageCipher(c: CipherView): boolean { diff --git a/apps/web/src/app/dirt/reports/pages/organizations/unsecured-websites-report.component.ts b/apps/web/src/app/dirt/reports/pages/organizations/unsecured-websites-report.component.ts index 2e916da029..dad9688f10 100644 --- a/apps/web/src/app/dirt/reports/pages/organizations/unsecured-websites-report.component.ts +++ b/apps/web/src/app/dirt/reports/pages/organizations/unsecured-websites-report.component.ts @@ -89,7 +89,7 @@ export class UnsecuredWebsitesReportComponent } getAllCiphers(): Promise { - return this.cipherService.getAllFromApiForOrganization(this.organization.id); + return this.cipherService.getAllFromApiForOrganization(this.organization.id, true); } protected canManageCipher(c: CipherView): boolean { diff --git a/apps/web/src/app/dirt/reports/pages/organizations/weak-passwords-report.component.ts b/apps/web/src/app/dirt/reports/pages/organizations/weak-passwords-report.component.ts index 80be66e9ad..67ca5081b6 100644 --- a/apps/web/src/app/dirt/reports/pages/organizations/weak-passwords-report.component.ts +++ b/apps/web/src/app/dirt/reports/pages/organizations/weak-passwords-report.component.ts @@ -88,7 +88,7 @@ export class WeakPasswordsReportComponent } getAllCiphers(): Promise { - return this.cipherService.getAllFromApiForOrganization(this.organization.id); + return this.cipherService.getAllFromApiForOrganization(this.organization.id, true); } canManageCipher(c: CipherView): boolean { diff --git a/libs/common/src/abstractions/api.service.ts b/libs/common/src/abstractions/api.service.ts index 93e47a6d9a..761038c2e4 100644 --- a/libs/common/src/abstractions/api.service.ts +++ b/libs/common/src/abstractions/api.service.ts @@ -194,7 +194,10 @@ export abstract class ApiService { cipherId: string, attachmentId: string, ): Promise; - abstract getCiphersOrganization(organizationId: string): Promise>; + abstract getCiphersOrganization( + organizationId: string, + includeMemberItems?: boolean, + ): Promise>; abstract postCipher(request: CipherRequest): Promise; abstract postCipherCreate(request: CipherCreateRequest): Promise; abstract postCipherAdmin(request: CipherCreateRequest): Promise; diff --git a/libs/common/src/services/api.service.ts b/libs/common/src/services/api.service.ts index 3b4fef9c5c..b7f5f0ed00 100644 --- a/libs/common/src/services/api.service.ts +++ b/libs/common/src/services/api.service.ts @@ -408,14 +408,15 @@ export class ApiService implements ApiServiceAbstraction { return new CipherResponse(r); } - async getCiphersOrganization(organizationId: string): Promise> { - const r = await this.send( - "GET", - "/ciphers/organization-details?organizationId=" + organizationId, - null, - true, - true, - ); + async getCiphersOrganization( + organizationId: string, + includeMemberItems?: boolean, + ): Promise> { + let url = "/ciphers/organization-details?organizationId=" + organizationId; + if (includeMemberItems) { + url += `&includeMemberItems=${includeMemberItems}`; + } + const r = await this.send("GET", url, null, true, true); return new ListResponse(r, CipherResponse); } diff --git a/libs/common/src/vault/abstractions/cipher.service.ts b/libs/common/src/vault/abstractions/cipher.service.ts index 7971b6d465..9aefd960b2 100644 --- a/libs/common/src/vault/abstractions/cipher.service.ts +++ b/libs/common/src/vault/abstractions/cipher.service.ts @@ -76,7 +76,10 @@ export abstract class CipherService implements UserKeyRotationDataProvider; - abstract getAllFromApiForOrganization(organizationId: string): Promise; + abstract getAllFromApiForOrganization( + organizationId: string, + includeMemberItems?: boolean, + ): Promise; /** * Gets ciphers belonging to the specified organization that the user has explicit collection level access to. * Ciphers that are not assigned to any collections are only included for users with admin access. diff --git a/libs/common/src/vault/services/cipher.service.ts b/libs/common/src/vault/services/cipher.service.ts index 8032c69ed7..52c83c5a10 100644 --- a/libs/common/src/vault/services/cipher.service.ts +++ b/libs/common/src/vault/services/cipher.service.ts @@ -691,8 +691,14 @@ export class CipherService implements CipherServiceAbstraction { .sort((a, b) => this.sortCiphersByLastUsedThenName(a, b)); } - async getAllFromApiForOrganization(organizationId: string): Promise { - const response = await this.apiService.getCiphersOrganization(organizationId); + async getAllFromApiForOrganization( + organizationId: string, + includeMemberItems?: boolean, + ): Promise { + const response = await this.apiService.getCiphersOrganization( + organizationId, + includeMemberItems, + ); return await this.decryptOrganizationCiphersResponse(response, organizationId); }