1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-06 03:33:30 +00:00

update all org reports to get permission data from cached ciphers

This commit is contained in:
Brad Deibert
2026-01-14 17:03:37 -08:00
parent 952ee02376
commit 32a4392762
5 changed files with 84 additions and 9 deletions

View File

@@ -91,8 +91,23 @@ export class ExposedPasswordsReportComponent
});
}
getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllFromApiForOrganization(this.organization.id, true);
async getAllCiphers(): Promise<CipherView[]> {
const orgCiphers = await this.cipherService.getAllFromApiForOrganization(
this.organization.id,
true,
);
// response from API above does not include permission levels for ciphers. look up ciphers in cache and use current user's permissions where possible
orgCiphers.map((cipher) => {
const editable = this.manageableCiphers.find((c) => c.id === cipher.id);
if (editable) {
cipher.edit = editable.edit;
cipher.viewPassword = editable.viewPassword;
cipher.permissions = editable.permissions;
}
});
return orgCiphers;
}
canManageCipher(c: CipherView): boolean {

View File

@@ -98,7 +98,22 @@ export class InactiveTwoFactorReportComponent
async getAllCiphers(): Promise<CipherView[]> {
if (this.organization) {
return await this.cipherService.getAllFromApiForOrganization(this.organization.id, true);
const orgCiphers = await this.cipherService.getAllFromApiForOrganization(
this.organization.id,
true,
);
// response from API above does not include permission levels for ciphers. look up ciphers in cache and use current user's permissions where possible
orgCiphers.map((cipher) => {
const editable = this.manageableCiphers.find((c) => c.id === cipher.id);
if (editable) {
cipher.edit = editable.edit;
cipher.viewPassword = editable.viewPassword;
cipher.permissions = editable.permissions;
}
});
return orgCiphers;
}
return [];
}

View File

@@ -89,8 +89,23 @@ export class ReusedPasswordsReportComponent
});
}
getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllFromApiForOrganization(this.organization.id, true);
async getAllCiphers(): Promise<CipherView[]> {
const orgCiphers = await this.cipherService.getAllFromApiForOrganization(
this.organization.id,
true,
);
// response from API above does not include permission levels for ciphers. look up ciphers in cache and use current user's permissions where possible
orgCiphers.map((cipher) => {
const editable = this.manageableCiphers.find((c) => c.id === cipher.id);
if (editable) {
cipher.edit = editable.edit;
cipher.viewPassword = editable.viewPassword;
cipher.permissions = editable.permissions;
}
});
return orgCiphers;
}
canManageCipher(c: CipherView): boolean {

View File

@@ -94,8 +94,23 @@ export class UnsecuredWebsitesReportComponent
});
}
getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllFromApiForOrganization(this.organization.id, true);
async getAllCiphers(): Promise<CipherView[]> {
const orgCiphers = await this.cipherService.getAllFromApiForOrganization(
this.organization.id,
true,
);
// response from API above does not include permission levels for ciphers. look up ciphers in cache and use current user's permissions where possible
orgCiphers.map((cipher) => {
const editable = this.manageableCiphers.find((c) => c.id === cipher.id);
if (editable) {
cipher.edit = editable.edit;
cipher.viewPassword = editable.viewPassword;
cipher.permissions = editable.permissions;
}
});
return orgCiphers;
}
protected canManageCipher(c: CipherView): boolean {

View File

@@ -93,8 +93,23 @@ export class WeakPasswordsReportComponent
});
}
getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllFromApiForOrganization(this.organization.id, true);
async getAllCiphers(): Promise<CipherView[]> {
const orgCiphers = await this.cipherService.getAllFromApiForOrganization(
this.organization.id,
true,
);
// response from API above does not include permission levels for ciphers. look up ciphers in cache and use current user's permissions where possible
orgCiphers.map((cipher) => {
const editable = this.manageableCiphers.find((c) => c.id === cipher.id);
if (editable) {
cipher.edit = editable.edit;
cipher.viewPassword = editable.viewPassword;
cipher.permissions = editable.permissions;
}
});
return orgCiphers;
}
canManageCipher(c: CipherView): boolean {