Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
readValues.Consortium = new common.ConfigValue();
const readAppGroup = {};
for (const mspId of channelObject.msps) {
readAppGroup[mspId] = new common.ConfigGroup();
}
const readGroups = {};
readGroups.Application = new common.ConfigGroup({ groups: readAppGroup });
const readSet = new common.ConfigGroup({ version: readVersion, groups: readGroups, values: readValues });
// Build the writeSet (based on consortium name and passed Capabiliites)
const modPolicy = 'Admins';
const writeValues = {};
const consortium = new common.Consortium({ name: channelObject.consortium });
writeValues.Consortium = new common.ConfigValue({ version: writeVersion, value: consortium.toBuffer() });
if (channelObject.capabilities) {
const capabilities = this._populateCapabilities(channelObject.capabilities);
writeValues.Capabilities = new common.ConfigValue({ version: writeVersion, value: capabilities.toBuffer(), mod_policy: modPolicy });
}
// Write Policy
const writePolicies = this._generateWritePolicy(policyVersion, modPolicy);
// Write Application Groups
const writeAppGroup = {};
for (const mspId of channelObject.msps) {
writeAppGroup[mspId] = new common.ConfigGroup();
}
readValues.Consortium = new common.ConfigValue();
const readAppGroup = {};
for (const mspId of mspIds) {
readAppGroup[mspId] = new common.ConfigGroup();
}
const readGroups = {};
readGroups.Application = new common.ConfigGroup({ groups: readAppGroup });
const readSet = new common.ConfigGroup({ version: readVersion, groups: readGroups, values: readValues });
// Build the writeSet (based on consortium name and passed Capabiliites)
const modPolicy = 'Admins';
const writeValues = {};
const consortium = new common.Consortium({ name: consortiumName });
writeValues.Consortium = new common.ConfigValue({ version: writeVersion, value: consortium.toBuffer() });
if (applicationCapabilities) {
const capabilities = populateCapabilities(applicationCapabilities);
writeValues.Capabilities = new common.ConfigValue({ version: writeVersion, value: capabilities.toBuffer(), mod_policy: modPolicy });
}
// Write Policy
const writePolicies = generateWritePolicy(policyVersion, modPolicy);
// Write Application Groups
const writeAppGroup = {};
for (const mspId of mspIds) {
writeAppGroup[mspId] = new common.ConfigGroup();
}