mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +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:
@@ -39,6 +39,9 @@ export class DownloadAttachmentComponent {
|
||||
// Required for fetching attachment data when viewed from cipher via emergency access
|
||||
@Input() emergencyAccessId?: EmergencyAccessId;
|
||||
|
||||
/** When accessing from the admin console, we will want to call the admin endpoint */
|
||||
@Input() admin?: boolean = false;
|
||||
|
||||
/** The organization key if the cipher is associated with one */
|
||||
private orgKey: OrgKey | null = null;
|
||||
|
||||
@@ -68,11 +71,13 @@ export class DownloadAttachmentComponent {
|
||||
let url: string;
|
||||
|
||||
try {
|
||||
const attachmentDownloadResponse = await this.apiService.getAttachmentData(
|
||||
this.cipher.id,
|
||||
this.attachment.id,
|
||||
this.emergencyAccessId,
|
||||
);
|
||||
const attachmentDownloadResponse = this.admin
|
||||
? await this.apiService.getAttachmentDataAdmin(this.cipher.id, this.attachment.id)
|
||||
: await this.apiService.getAttachmentData(
|
||||
this.cipher.id,
|
||||
this.attachment.id,
|
||||
this.emergencyAccessId,
|
||||
);
|
||||
url = attachmentDownloadResponse.url;
|
||||
} catch (e) {
|
||||
if (e instanceof ErrorResponse && (e as ErrorResponse).statusCode === 404) {
|
||||
|
||||
Reference in New Issue
Block a user