Skip to content

Commit

Permalink
BE-857 Change invoking function of lifecycle scc to allow non-admin c…
Browse files Browse the repository at this point in the history
…lient access (#252)

Signed-off-by: Atsushi Neki <nekiaiken@gmail.com>
  • Loading branch information
nekia authored Jul 1, 2021
1 parent cc51dff commit ba59056
Show file tree
Hide file tree
Showing 4 changed files with 1,272 additions and 1,457 deletions.
4 changes: 2 additions & 2 deletions app/platform/fabric/connection-profile/test-network.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
"Org1MSP": {
"mspid": "Org1MSP",
"adminPrivateKey": {
"path": "/fabric-path/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv_sk"
"path": "/fabric-path/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk"
},
"peers": ["peer0.org1.example.com"],
"signedCert": {
"path": "/fabric-path/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem"
"path": "/fabric-path/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem"
}
}
},
Expand Down
16 changes: 7 additions & 9 deletions app/platform/fabric/gateway/FabricGateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,15 @@ export class FabricGateway {
if (resultJson.chaincodes.length <= 0) {
resultJson = { chaincodes: [], toJSON: null };
contract = network.getContract('_lifecycle');
result = await contract.evaluateTransaction('QueryInstalledChaincodes', '');
const decodedReult = fabprotos.lifecycle.QueryInstalledChaincodesResult.decode(
result = await contract.evaluateTransaction('QueryChaincodeDefinitions', '');
const decodedReult = fabprotos.lifecycle.QueryChaincodeDefinitionsResult.decode(
result
);
for (const cc of decodedReult.installed_chaincodes) {
logger.info('1:', cc);
const ccInfo = cc.references[channelName];
if (ccInfo !== undefined) {
logger.info('2:', ccInfo);
resultJson.chaincodes = concat(resultJson.chaincodes, ccInfo.chaincodes);
}
for (const cc of decodedReult.chaincode_definitions) {
resultJson.chaincodes = concat(resultJson.chaincodes, {
name: cc.name,
version: cc.version
});
}
}
logger.debug('queryInstantiatedChaincodes', resultJson);
Expand Down
4 changes: 2 additions & 2 deletions examples/net1/connection-profile/test-network.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"Org1MSP": {
"mspid": "Org1MSP",
"adminPrivateKey": {
"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv_sk"
"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk"
},
"peers": ["peer0.org1.example.com"],
"signedCert": {
"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem"
"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem"
}
}
},
Expand Down
Loading

0 comments on commit ba59056

Please sign in to comment.