/** * Constructor for a member. * * @param {string} cfg - The member name or an object with the following attributes: * - enrollmentID {string}: user name * - name {string}: user name, if "enrollmentID" is also specified, the "name" is ignored * - roles {string[]}: optional. array of roles * - affiliation {string}: optional. affiliation with a group or organization */ constructor(cfg) { if (util.isString(cfg)) { this._name = cfg; this._roles = null; // string[] this._affiliation = ''; } else if (util.isObject(cfg)) { const req = cfg; this._name = req.enrollmentID || req.name; this._roles = req.roles || ['fabric.user']; this._affiliation = req.affiliation; } this._enrollmentSecret = ''; this._identity = null; this._signingIdentity = null; this._mspId = ''; this._cryptoSuite = null; }
/** * Constructor for a member. * * @param {string} cfg - The member name or an object with the following attributes: * - enrollmentID {string}: user name * - name {string}: user name, if "enrollmentID" is also specified, the "name" is ignored * - roles {string[]}: optional. array of roles * - affiliation {string}: optional. affiliation with a group or organization */ constructor(cfg) { if (util.isString(cfg)) { this._name = cfg; this._roles = null; // string[] this._affiliation = ''; } else if (util.isObject(cfg)) { const req = cfg; this._name = req.enrollmentID || req.name; this._roles = req.roles || ['fabric.user']; this._affiliation = req.affiliation; } this._enrollmentSecret = ''; this._identity = null; this._signingIdentity = null; this._mspId = ''; this._cryptoSuite = null; }