pass original cipher if admin. resolves #245

This commit is contained in:
Kyle Spearrin 2018-08-15 11:47:47 -04:00
parent 5cdfa35a76
commit 39c32b0e62
2 changed files with 9 additions and 3 deletions

2
jslib

@ -1 +1 @@
Subproject commit d56c5ff4f157b346500ceb0c256e88daaf4c4684
Subproject commit f16fc58d707b9ed55355e62440fb95185f972090

View File

@ -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,15 +50,20 @@ 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;
}
if (!this.organization.isAdmin) {
return super.encryptCipher();
}
return this.cipherService.encrypt(this.cipher, null, this.originalCipher);
}
protected async saveCipher(cipher: Cipher) {
if (!this.organization.isAdmin) {