1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

[PM-18322] Fix: Allow organization admins to upload attachments for items without direct access (#14361)

* Wire organization ID into AttachmentsV2Component for org-based ciphers

* Enhance AttachmentsV2Component to accept organization ID for improved handling of org-based ciphers

* Integrate organization ID into VaultComponent for AttachmentsV2Component to enhance org-based cipher handling

* Add unit tests for CipherAttachmentsComponent to validate attachment saving behavior for admins

- Introduced mocks for ApiService and OrganizationService in the test setup.
- Updated tests to check `saveAttachmentWithServer` calls with the correct parameters, including an `isAdmin` flag for admin API usage.

* Fix unit tests for AttachmentsV2Component by adding mocks for ApiService and OrganizationService

* Fix AttachmentsV2Component tests
This commit is contained in:
Rui Tomé
2025-04-29 12:42:02 +01:00
committed by GitHub
parent 67b1158bf0
commit 9cd08e8a9f
10 changed files with 122 additions and 21 deletions

View File

@@ -3,7 +3,7 @@
import { CommonModule } from "@angular/common";
import { Component, Inject } from "@angular/core";
import { CipherId } from "@bitwarden/common/types/guid";
import { CipherId, OrganizationId } from "@bitwarden/common/types/guid";
import {
ButtonModule,
DialogModule,
@@ -17,6 +17,7 @@ import { CipherAttachmentsComponent } from "../../cipher-form/components/attachm
export interface AttachmentsDialogParams {
cipherId: CipherId;
organizationId?: OrganizationId;
}
/**
@@ -43,6 +44,7 @@ export interface AttachmentDialogCloseResult {
})
export class AttachmentsV2Component {
cipherId: CipherId;
organizationId?: OrganizationId;
attachmentFormId = CipherAttachmentsComponent.attachmentFormID;
/**
@@ -55,6 +57,7 @@ export class AttachmentsV2Component {
@Inject(DIALOG_DATA) public params: AttachmentsDialogParams,
) {
this.cipherId = params.cipherId;
this.organizationId = params.organizationId;
}
/**