1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

validate edit access when opening view form

This commit is contained in:
Nick Krantz
2024-10-04 10:36:12 -05:00
parent ca3a36952e
commit 85a53f4e59

View File

@@ -896,16 +896,22 @@ export class VaultComponent implements OnInit, OnDestroy {
cipher?.type, cipher?.type,
); );
await this.openVaultItemDialog("view", cipherFormConfig); await this.openVaultItemDialog("view", cipherFormConfig, cipher);
} }
/** /**
* Open the combined view / edit dialog for a 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, { this.vaultItemDialogRef = VaultItemDialogComponent.open(this.dialogService, {
mode, mode,
formConfig, formConfig,
disableForm,
}); });
const result = await lastValueFrom(this.vaultItemDialogRef.closed); const result = await lastValueFrom(this.vaultItemDialogRef.closed);