From 85a53f4e5986cf0abe80e34924589c7a869ab48b Mon Sep 17 00:00:00 2001 From: Nick Krantz Date: Fri, 4 Oct 2024 10:36:12 -0500 Subject: [PATCH] validate edit access when opening view form --- apps/web/src/app/vault/org-vault/vault.component.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/vault/org-vault/vault.component.ts b/apps/web/src/app/vault/org-vault/vault.component.ts index 51ca56be7b5..7db7656cb20 100644 --- a/apps/web/src/app/vault/org-vault/vault.component.ts +++ b/apps/web/src/app/vault/org-vault/vault.component.ts @@ -896,16 +896,22 @@ export class VaultComponent implements OnInit, OnDestroy { cipher?.type, ); - await this.openVaultItemDialog("view", cipherFormConfig); + await this.openVaultItemDialog("view", cipherFormConfig, cipher); } /** * Open the combined view / edit dialog for a cipher. */ - async openVaultItemDialog(mode: VaultItemDialogMode, formConfig: CipherFormConfig) { + async openVaultItemDialog( + mode: VaultItemDialogMode, + formConfig: CipherFormConfig, + cipher?: CipherView, + ) { + const disableForm = cipher ? !cipher.edit && !this.organization.canEditAllCiphers : false; this.vaultItemDialogRef = VaultItemDialogComponent.open(this.dialogService, { mode, formConfig, + disableForm, }); const result = await lastValueFrom(this.vaultItemDialogRef.closed);