From 39c32b0e62f957eb3a37b9947cdc1021f89f6447 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 15 Aug 2018 11:47:47 -0400 Subject: [PATCH] pass original cipher if admin. resolves #245 --- jslib | 2 +- src/app/organizations/vault/add-edit.component.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/jslib b/jslib index d56c5ff4f1..f16fc58d70 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit d56c5ff4f157b346500ceb0c256e88daaf4c4684 +Subproject commit f16fc58d707b9ed55355e62440fb95185f972090 diff --git a/src/app/organizations/vault/add-edit.component.ts b/src/app/organizations/vault/add-edit.component.ts index fada8af1d0..e38a290d25 100644 --- a/src/app/organizations/vault/add-edit.component.ts +++ b/src/app/organizations/vault/add-edit.component.ts @@ -31,6 +31,7 @@ import { AddEditComponent as BaseAddEditComponent } from '../../vault/add-edit.c }) export class AddEditComponent extends BaseAddEditComponent implements OnInit { organization: Organization; + originalCipher: Cipher = null; constructor(cipherService: CipherService, folderService: FolderService, i18nService: I18nService, platformUtilsService: PlatformUtilsService, @@ -49,14 +50,19 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit { return await super.loadCipher(); } const response = await this.apiService.getCipherAdmin(this.cipherId); - return new Cipher(new CipherData(response)); + const data = new CipherData(response); + this.originalCipher = new Cipher(data); + return new Cipher(data); } protected encryptCipher() { if (!this.editMode) { this.cipher.organizationId = this.organization.id; } - return super.encryptCipher(); + if (!this.organization.isAdmin) { + return super.encryptCipher(); + } + return this.cipherService.encrypt(this.cipher, null, this.originalCipher); } protected async saveCipher(cipher: Cipher) {