1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 07:13:32 +00:00

[PM-19383] admins unable to download attachments (#14363)

* add admin support for downloading attachments

* fix delete and upload

* fix delete admin to return a response

* fix upload

* add missing param

* use getCipherAdmin

* fix cli
This commit is contained in:
Brandon Treston
2025-05-05 13:36:49 -04:00
committed by GitHub
parent a408990a3c
commit fd43222938
15 changed files with 72 additions and 16 deletions

View File

@@ -460,14 +460,29 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
const activeUserId = await firstValueFrom(
this.accountService.activeAccount$.pipe(map((a) => a?.id)),
);
const updatedCipher = await this.cipherService.get(
this.formConfig.originalCipher?.id,
activeUserId,
);
const updatedCipherView = await updatedCipher.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(updatedCipher, activeUserId),
);
let updatedCipherView: CipherView;
if (this.formConfig.admin) {
const cipherResponse = await this.apiService.getCipherAdmin(
this.formConfig.originalCipher?.id,
);
const cipherData = new CipherData(cipherResponse);
const cipher = new Cipher(cipherData);
updatedCipherView = await cipher.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(cipher, activeUserId),
);
} else {
const updatedCipher = await this.cipherService.get(
this.formConfig.originalCipher?.id,
activeUserId,
);
updatedCipherView = await updatedCipher.decrypt(
await this.cipherService.getKeyForCipherKeyDecryption(updatedCipher, activeUserId),
);
}
this.cipherFormComponent.patchCipher((currentCipher) => {
currentCipher.attachments = updatedCipherView.attachments;