1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 22:03:36 +00:00

Adding include my items to the services and reports (#16987)

This commit is contained in:
Tom
2025-10-23 12:54:52 -04:00
committed by GitHub
parent 2c13236550
commit 81e9015b5b
8 changed files with 29 additions and 16 deletions

View File

@@ -86,7 +86,7 @@ export class ExposedPasswordsReportComponent
} }
getAllCiphers(): Promise<CipherView[]> { getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllFromApiForOrganization(this.organization.id); return this.cipherService.getAllFromApiForOrganization(this.organization.id, true);
} }
canManageCipher(c: CipherView): boolean { canManageCipher(c: CipherView): boolean {

View File

@@ -84,7 +84,7 @@ export class ReusedPasswordsReportComponent
} }
getAllCiphers(): Promise<CipherView[]> { getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllFromApiForOrganization(this.organization.id); return this.cipherService.getAllFromApiForOrganization(this.organization.id, true);
} }
canManageCipher(c: CipherView): boolean { canManageCipher(c: CipherView): boolean {

View File

@@ -89,7 +89,7 @@ export class UnsecuredWebsitesReportComponent
} }
getAllCiphers(): Promise<CipherView[]> { getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllFromApiForOrganization(this.organization.id); return this.cipherService.getAllFromApiForOrganization(this.organization.id, true);
} }
protected canManageCipher(c: CipherView): boolean { protected canManageCipher(c: CipherView): boolean {

View File

@@ -88,7 +88,7 @@ export class WeakPasswordsReportComponent
} }
getAllCiphers(): Promise<CipherView[]> { getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllFromApiForOrganization(this.organization.id); return this.cipherService.getAllFromApiForOrganization(this.organization.id, true);
} }
canManageCipher(c: CipherView): boolean { canManageCipher(c: CipherView): boolean {

View File

@@ -194,7 +194,10 @@ export abstract class ApiService {
cipherId: string, cipherId: string,
attachmentId: string, attachmentId: string,
): Promise<AttachmentResponse>; ): Promise<AttachmentResponse>;
abstract getCiphersOrganization(organizationId: string): Promise<ListResponse<CipherResponse>>; abstract getCiphersOrganization(
organizationId: string,
includeMemberItems?: boolean,
): Promise<ListResponse<CipherResponse>>;
abstract postCipher(request: CipherRequest): Promise<CipherResponse>; abstract postCipher(request: CipherRequest): Promise<CipherResponse>;
abstract postCipherCreate(request: CipherCreateRequest): Promise<CipherResponse>; abstract postCipherCreate(request: CipherCreateRequest): Promise<CipherResponse>;
abstract postCipherAdmin(request: CipherCreateRequest): Promise<CipherResponse>; abstract postCipherAdmin(request: CipherCreateRequest): Promise<CipherResponse>;

View File

@@ -408,14 +408,15 @@ export class ApiService implements ApiServiceAbstraction {
return new CipherResponse(r); return new CipherResponse(r);
} }
async getCiphersOrganization(organizationId: string): Promise<ListResponse<CipherResponse>> { async getCiphersOrganization(
const r = await this.send( organizationId: string,
"GET", includeMemberItems?: boolean,
"/ciphers/organization-details?organizationId=" + organizationId, ): Promise<ListResponse<CipherResponse>> {
null, let url = "/ciphers/organization-details?organizationId=" + organizationId;
true, if (includeMemberItems) {
true, url += `&includeMemberItems=${includeMemberItems}`;
); }
const r = await this.send("GET", url, null, true, true);
return new ListResponse(r, CipherResponse); return new ListResponse(r, CipherResponse);
} }

View File

@@ -76,7 +76,10 @@ export abstract class CipherService implements UserKeyRotationDataProvider<Ciphe
/** When true, will override the match strategy for the cipher if it is Never. */ /** When true, will override the match strategy for the cipher if it is Never. */
overrideNeverMatchStrategy?: true, overrideNeverMatchStrategy?: true,
): Promise<C[]>; ): Promise<C[]>;
abstract getAllFromApiForOrganization(organizationId: string): Promise<CipherView[]>; abstract getAllFromApiForOrganization(
organizationId: string,
includeMemberItems?: boolean,
): Promise<CipherView[]>;
/** /**
* Gets ciphers belonging to the specified organization that the user has explicit collection level access to. * 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. * Ciphers that are not assigned to any collections are only included for users with admin access.

View File

@@ -691,8 +691,14 @@ export class CipherService implements CipherServiceAbstraction {
.sort((a, b) => this.sortCiphersByLastUsedThenName(a, b)); .sort((a, b) => this.sortCiphersByLastUsedThenName(a, b));
} }
async getAllFromApiForOrganization(organizationId: string): Promise<CipherView[]> { async getAllFromApiForOrganization(
const response = await this.apiService.getCiphersOrganization(organizationId); organizationId: string,
includeMemberItems?: boolean,
): Promise<CipherView[]> {
const response = await this.apiService.getCiphersOrganization(
organizationId,
includeMemberItems,
);
return await this.decryptOrganizationCiphersResponse(response, organizationId); return await this.decryptOrganizationCiphersResponse(response, organizationId);
} }