Skip to content

Commit

Permalink
[FAB-6609] add an option key 'skipPersistence'
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
davidkhala committed Oct 25, 2017
1 parent 07a6323 commit 1060568
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fabric-client/lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/

/**
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1060568

Please sign in to comment.