From 41d6b6bd2168ae65cdb6e3ae28e4e16b633fe09b Mon Sep 17 00:00:00 2001 From: dgoodman-bw <109169446+dgoodman-bw@users.noreply.github.com> Date: Tue, 25 Oct 2022 12:24:21 -0700 Subject: [PATCH] Ps 976 moving of read only organization collection items to different folder not possible (#3474) * PS-976 - when user has cipher readonly permissions, prevent user from editing cipher fields and make separate api call that only updates Favorite and Folder values * PS-976 - in the readonly edit cipher view, hide non-operable buttons and display select values as readonly input text * PS-976 - update failing test * PS-976 - split cipher saveWithServer call into Create and Update calls * PS-976 - replace property with function call to get the card expiration month for the readonly view * MM-976 - when user has readonly permissions hide "delete" button on View Item view, hide generate username/password buttons on Edit Item view * PS-976 - rename cipherPartialRequest file to align with new naming convention --- .../src/background/notification.background.ts | 4 +- .../add-edit-custom-fields.component.html | 18 ++- .../src/popup/vault/add-edit.component.html | 107 +++++++++++--- .../src/popup/vault/view.component.html | 8 +- .../browser/src/popup/vault/view.component.ts | 2 +- apps/cli/src/commands/create.command.ts | 2 +- apps/cli/src/commands/edit.command.ts | 2 +- .../add-edit-custom-fields.component.html | 14 +- .../src/app/vault/add-edit.component.html | 107 ++++++++++++-- .../desktop/src/app/vault/view.component.html | 2 +- .../encryptedMessageHandlerService.ts | 4 +- .../add-edit-custom-fields.component.html | 11 +- .../web/src/app/vault/add-edit.component.html | 136 +++++++++++++----- .../src/components/add-edit.component.ts | 8 +- libs/common/src/abstractions/api.service.ts | 2 + .../common/src/abstractions/cipher.service.ts | 3 +- .../models/request/cipher-partial.request.ts | 11 ++ libs/common/src/services/api.service.ts | 6 + libs/common/src/services/cipher.service.ts | 31 ++-- 19 files changed, 382 insertions(+), 96 deletions(-) create mode 100644 libs/common/src/models/request/cipher-partial.request.ts diff --git a/apps/browser/src/background/notification.background.ts b/apps/browser/src/background/notification.background.ts index 569a77abe7..64b7ca8a7e 100644 --- a/apps/browser/src/background/notification.background.ts +++ b/apps/browser/src/background/notification.background.ts @@ -394,7 +394,7 @@ export default class NotificationBackground { } const cipher = await this.cipherService.encrypt(model); - await this.cipherService.saveWithServer(cipher); + await this.cipherService.createWithServer(cipher); } private async getDecryptedCipherById(cipherId: string) { @@ -409,7 +409,7 @@ export default class NotificationBackground { if (cipher != null && cipher.type === CipherType.Login) { cipher.login.password = newPassword; const newCipher = await this.cipherService.encrypt(cipher); - await this.cipherService.saveWithServer(newCipher); + await this.cipherService.updateWithServer(newCipher); } } diff --git a/apps/browser/src/popup/vault/add-edit-custom-fields.component.html b/apps/browser/src/popup/vault/add-edit-custom-fields.component.html index def0af3003..8464655c20 100644 --- a/apps/browser/src/popup/vault/add-edit-custom-fields.component.html +++ b/apps/browser/src/popup/vault/add-edit-custom-fields.component.html @@ -19,6 +19,7 @@ appStopClick (click)="removeField(f)" appA11yTitle="{{ 'remove' | i18n }}" + *ngIf="!(!cipher.edit && editMode)" > @@ -33,6 +34,7 @@ class="row-label" placeholder="{{ 'name' | i18n }}" appInputVerbatim + [readonly]="!cipher.edit && editMode" />
-