From 106056896dedfa8a8a946ce270cd57487cabaf10 Mon Sep 17 00:00:00 2001 From: Yuxiang LIU Date: Fri, 13 Oct 2017 18:04:09 +0800 Subject: [PATCH] [FAB-6609] add an option key 'skipPersistence' This fix #6609 setUserContext is included in Client.createUser. Currently setUserContext is called in default way It means createUser will always save user to local persistent cache. This patch enhance user flexibility Change-Id: I45bc9c88be6e6b982d9f3561d981f2e5b4475f47 Signed-off-by: Yuxiang LIU --- fabric-client/lib/Client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fabric-client/lib/Client.js b/fabric-client/lib/Client.js index bf314c4485..c198657181 100644 --- a/fabric-client/lib/Client.js +++ b/fabric-client/lib/Client.js @@ -1392,6 +1392,7 @@ var Client = class extends BaseClient { * @property {string} username {string} - the user name used for enrollment * @property {string} mspid {string} - the MSP id * @property {IdentityFiles | IdentityPEMs} cryptoContent - the private key and certificate + * @property {boolean} skipPersistence - whether to save this new user object into persistence. */ /** @@ -1500,7 +1501,7 @@ var Client = class extends BaseClient { return member.setEnrollment(importedKey, data.toString(), opts.mspid); }).then(() => { logger.debug('then setUserContext'); - return self.setUserContext(member); + return self.setUserContext(member, opts.skipPersistence); }, (err) => { logger.debug('error during setUserContext...'); logger.error(err.stack ? err.stack : err);