diff --git a/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.spec.ts b/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.spec.ts index 1c0c76f84d9..3409fa9b8d3 100644 --- a/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.spec.ts +++ b/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.spec.ts @@ -374,6 +374,29 @@ describe("VaultItemDialogComponent", () => { }); }); + describe("disableEdit", () => { + it("returns false when formConfig mode is partial-edit even if canEdit is false", () => { + component["canEdit"] = false; + component.setTestFormConfig({ ...baseFormConfig, mode: "partial-edit" }); + + expect(component["disableEdit"]).toBe(false); + }); + + it("returns true when canEdit is false and formConfig mode is not partial-edit", () => { + component["canEdit"] = false; + component.setTestFormConfig({ ...baseFormConfig, mode: "edit" }); + + expect(component["disableEdit"]).toBe(true); + }); + + it("returns false when canEdit is true regardless of formConfig mode", () => { + component["canEdit"] = true; + component.setTestFormConfig({ ...baseFormConfig, mode: "edit" }); + + expect(component["disableEdit"]).toBe(false); + }); + }); + describe("changeMode", () => { beforeEach(() => { component.setTestCipher({ type: CipherType.Login, id: "cipher-id" }); diff --git a/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts b/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts index 4c6efdee167..bff760c5178 100644 --- a/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts +++ b/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts @@ -273,7 +273,7 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy { } protected get disableEdit() { - return !this.canEdit; + return !this.canEdit && this.formConfig.mode !== "partial-edit"; } protected get showEdit() { @@ -396,7 +396,7 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy { ); // If user cannot edit and dialog opened in form mode, force to view mode - if (!this.canEdit && this.params.mode === "form") { + if (!this.canEdit && this.formConfig.mode !== "partial-edit" && this.params.mode === "form") { this.params.mode = "view"; this.loadForm = false; this.updateTitle(); diff --git a/libs/common/src/vault/services/cipher-authorization.service.ts b/libs/common/src/vault/services/cipher-authorization.service.ts index eb89819a05e..ba200d4bf78 100644 --- a/libs/common/src/vault/services/cipher-authorization.service.ts +++ b/libs/common/src/vault/services/cipher-authorization.service.ts @@ -135,7 +135,7 @@ export class DefaultCipherAuthorizationService implements CipherAuthorizationSer * * {@link CipherAuthorizationService.canEditCipher$} */ - canEditCipher$(cipher: CipherLike, isAdminConsoleAction?: boolean): Observable { + canEditCipher$(cipher: CipherLike, isAdminConsoleAction: boolean = false): Observable { return this.organization$(cipher).pipe( map((organization) => { if (isAdminConsoleAction) {