From e480f7cfbcdd7d59c42ad969da72b5d01f4ead44 Mon Sep 17 00:00:00 2001 From: Jake Fink Date: Fri, 10 Mar 2023 12:53:41 -0500 Subject: [PATCH] [AC-1110] allow members with Delete Any Collection to delete collections (#4925) * [AC-1110] add anyCollection permission to delete collection * [AC-1110] add missing permission to header collection delete --- .../bulk-delete-dialog/bulk-delete-dialog.component.ts | 5 ++++- .../vault/org-vault/vault-header/vault-header.component.ts | 5 ++++- apps/web/src/app/vault/org-vault/vault-items.component.ts | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts b/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts index 66f87c3458..7b4bfb2e43 100644 --- a/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts +++ b/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts @@ -116,7 +116,10 @@ export class BulkDeleteDialogComponent { } private async deleteCollections(): Promise { - if (!this.organization.canDeleteAssignedCollections) { + if ( + !this.organization.canDeleteAssignedCollections && + !this.organization.canDeleteAnyCollection + ) { this.platformUtilsService.showToast( "error", this.i18nService.t("errorOccurred"), diff --git a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts index a6ddbaa0eb..e6e7537952 100644 --- a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts +++ b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts @@ -209,7 +209,10 @@ export class VaultHeaderComponent { } async deleteCollection(collection: CollectionView): Promise { - if (!this.organization.canDeleteAssignedCollections) { + if ( + !this.organization.canDeleteAnyCollection && + !this.organization.canDeleteAssignedCollections + ) { this.platformUtilsService.showToast( "error", this.i18nService.t("errorOccurred"), diff --git a/apps/web/src/app/vault/org-vault/vault-items.component.ts b/apps/web/src/app/vault/org-vault/vault-items.component.ts index 22718fc135..2faa2ea9ff 100644 --- a/apps/web/src/app/vault/org-vault/vault-items.component.ts +++ b/apps/web/src/app/vault/org-vault/vault-items.component.ts @@ -244,7 +244,10 @@ export class VaultItemsComponent extends BaseVaultItemsComponent implements OnDe } async deleteCollection(collection: CollectionView): Promise { - if (!this.organization.canDeleteAssignedCollections) { + if ( + !this.organization.canDeleteAssignedCollections && + !this.organization.canDeleteAnyCollection + ) { this.platformUtilsService.showToast( "error", this.i18nService.t("errorOccurred"), @@ -270,6 +273,7 @@ export class VaultItemsComponent extends BaseVaultItemsComponent implements OnDe null, this.i18nService.t("deletedCollectionId", collection.name) ); + this.actionPromise = null; await this.refresh(); } catch (e) { this.logService.error(e);