mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +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:
@@ -184,6 +184,7 @@ export abstract class CipherService implements UserKeyRotationDataProvider<Ciphe
|
||||
id: string,
|
||||
attachmentId: string,
|
||||
userId: UserId,
|
||||
admin: boolean,
|
||||
): Promise<CipherData>;
|
||||
abstract sortCiphersByLastUsed(a: CipherView, b: CipherView): number;
|
||||
abstract sortCiphersByLastUsedThenName(a: CipherView, b: CipherView): number;
|
||||
|
||||
@@ -1120,13 +1120,17 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
id: string,
|
||||
attachmentId: string,
|
||||
userId: UserId,
|
||||
admin: boolean = false,
|
||||
): Promise<CipherData> {
|
||||
let cipherResponse = null;
|
||||
try {
|
||||
cipherResponse = await this.apiService.deleteCipherAttachment(id, attachmentId);
|
||||
cipherResponse = admin
|
||||
? await this.apiService.deleteCipherAttachmentAdmin(id, attachmentId)
|
||||
: await this.apiService.deleteCipherAttachment(id, attachmentId);
|
||||
} catch (e) {
|
||||
return Promise.reject((e as ErrorResponse).getSingleMessage());
|
||||
}
|
||||
|
||||
const cipherData = CipherData.fromJSON(cipherResponse?.cipher);
|
||||
|
||||
return await this.deleteAttachment(id, cipherData.revisionDate, attachmentId, userId);
|
||||
|
||||
Reference in New Issue
Block a user