1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-05 19:23:19 +00:00

Adding the my items param

This commit is contained in:
Tom
2025-09-26 11:10:14 -04:00
parent 24f07dc1e1
commit c25fafd7b8
5 changed files with 27 additions and 14 deletions

View File

@@ -94,7 +94,7 @@ export class RiskInsightsReportService {
LEGACY_generateRawDataReport$(
organizationId: OrganizationId,
): Observable<LEGACY_CipherHealthReportDetail[]> {
const allCiphers$ = from(this.cipherService.getAllFromApiForOrganization(organizationId));
const allCiphers$ = from(this.cipherService.getAllFromApiForOrganization(organizationId, true));
const memberCiphers$ = from(
this.memberCipherDetailsApiService.getMemberCipherDetails(organizationId),
);
@@ -160,7 +160,7 @@ export class RiskInsightsReportService {
generateApplicationsReport$(
organizationId: OrganizationId,
): Observable<ApplicationHealthReportDetail[]> {
const allCiphers$ = from(this.cipherService.getAllFromApiForOrganization(organizationId));
const allCiphers$ = from(this.cipherService.getAllFromApiForOrganization(organizationId, true));
const memberCiphers$ = from(
this.memberCipherDetailsApiService.getMemberCipherDetails(organizationId),
).pipe(map((memberCiphers) => flattenMemberDetails(memberCiphers)));

View File

@@ -223,7 +223,10 @@ export abstract class ApiService {
cipherId: string,
attachmentId: string,
): 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 postCipherCreate(request: CipherCreateRequest): Promise<CipherResponse>;
abstract postCipherAdmin(request: CipherCreateRequest): Promise<CipherResponse>;

View File

@@ -451,14 +451,15 @@ export class ApiService implements ApiServiceAbstraction {
return new CipherResponse(r);
}
async getCiphersOrganization(organizationId: string): Promise<ListResponse<CipherResponse>> {
const r = await this.send(
"GET",
"/ciphers/organization-details?organizationId=" + organizationId,
null,
true,
true,
);
async getCiphersOrganization(
organizationId: string,
includeMemberItems?: boolean,
): Promise<ListResponse<CipherResponse>> {
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);
}

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. */
overrideNeverMatchStrategy?: true,
): 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.
* Ciphers that are not assigned to any collections are only included for users with admin access.

View File

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