/** * Sample access control list. */ rule Default { description: "Allow all participants access to all resources" participant: "ANY" operation: ALL resource: "org.acme.shipping.perishable.*" action: ALLOW } rule SystemACL { description: "System ACL to permit all access" participant: "org.hyperledger.composer.system.Participant" operation: ALL resource: "org.hyperledger.composer.system.**" action: ALLOW } |
/** * A temperature reading has been received for a shipment * @param {org.acme.shipping.perishable.TemperatureReading} temperatureReading - the TemperatureReading transaction * @transaction */ function temperatureReading(temperatureReading) { var shipment = temperatureReading.shipment; console.log('Adding temperature ' + temperatureReading.centigrade + ' to shipment ' + shipment.$identifier); if (shipment.temperatureReadings) { shipment.temperatureReadings.push(temperatureReading); } else { shipment.temperatureReadings = [temperatureReading]; } return getAssetRegistry('org.acme.shipping.perishable.Shipment') .then(function (shipmentRegistry) { // add the temp reading to the shipment return shipmentRegistry.update(shipment); }); } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |