1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[AC-1344] Provider users unable to bulk restore vault items for client organizations (#5259)

* [AC-1344] Simplified DeleteMany and SoftDeleteMany request creation

* [AC-1344] Added method putRestoreManyCiphersAdmin to apiService

* [AC-1344] Added method restoreManyWithServer to cipherService

* [AC-1344] Rewrote if statements and changed the method return type
This commit is contained in:
Rui Tomé
2023-08-02 16:22:28 +01:00
committed by GitHub
parent fb74c2d6ee
commit 72a6fa1f7d
7 changed files with 54 additions and 14 deletions

View File

@@ -2,12 +2,14 @@ import { DialogConfig, DialogRef, DIALOG_DATA } from "@angular/cdk/dialog";
import { Component, Inject } from "@angular/core";
import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
export interface BulkRestoreDialogParams {
cipherIds: string[];
organization?: Organization;
}
export enum BulkRestoreDialogResult {
@@ -35,6 +37,7 @@ export const openBulkRestoreDialog = (
})
export class BulkRestoreDialogComponent {
cipherIds: string[];
organization?: Organization;
constructor(
@Inject(DIALOG_DATA) params: BulkRestoreDialogParams,
@@ -44,10 +47,12 @@ export class BulkRestoreDialogComponent {
private i18nService: I18nService
) {
this.cipherIds = params.cipherIds ?? [];
this.organization = params.organization;
}
submit = async () => {
await this.cipherService.restoreManyWithServer(this.cipherIds);
const asAdmin = this.organization?.canEditAnyCollection;
await this.cipherService.restoreManyWithServer(this.cipherIds, this.organization?.id, asAdmin);
this.platformUtilsService.showToast("success", null, this.i18nService.t("restoredItems"));
this.close(BulkRestoreDialogResult.Restored);
};

View File

@@ -695,7 +695,7 @@ export class VaultComponent implements OnInit, OnDestroy {
}
const dialog = openBulkRestoreDialog(this.dialogService, {
data: { cipherIds: selectedCipherIds },
data: { cipherIds: selectedCipherIds, organization: this.organization },
});
const result = await lastValueFrom(dialog.closed);