mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 07:13:32 +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:
@@ -20,7 +20,7 @@ import { ConfigService } from "@bitwarden/common/platform/abstractions/config/co
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
|
||||
import { CipherId, CollectionId } from "@bitwarden/common/types/guid";
|
||||
import { CipherId, CollectionId, OrganizationId } from "@bitwarden/common/types/guid";
|
||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||
import { PremiumUpgradePromptService } from "@bitwarden/common/vault/abstractions/premium-upgrade-prompt.service";
|
||||
import { ViewPasswordHistoryService } from "@bitwarden/common/vault/abstractions/view-password-history.service";
|
||||
@@ -441,14 +441,15 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
|
||||
return;
|
||||
}
|
||||
|
||||
const dialogRef = this.dialogService.open<AttachmentDialogCloseResult, { cipherId: CipherId }>(
|
||||
AttachmentsV2Component,
|
||||
{
|
||||
data: {
|
||||
cipherId: this.formConfig.originalCipher?.id as CipherId,
|
||||
},
|
||||
const dialogRef = this.dialogService.open<
|
||||
AttachmentDialogCloseResult,
|
||||
{ cipherId: CipherId; organizationId?: OrganizationId }
|
||||
>(AttachmentsV2Component, {
|
||||
data: {
|
||||
cipherId: this.formConfig.originalCipher?.id as CipherId,
|
||||
organizationId: this.formConfig.originalCipher?.organizationId as OrganizationId,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const result = await firstValueFrom(dialogRef.closed);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user