如何访问hyperledger composer的ACL文件中历史记录中的'eventEmitted'字段?
how to access the 'eventEmitted' field in historian record in ACL file of hyperledger composer?
我正在使用 Hyperledger Composer,我想访问历史记录中 'eventsEmitted' 数组中的 "to" 字段:
"eventsEmitted": [
{
"$class": "org.poc.wallet.WalletTransferEvent",
"from": "resource:org.poc.wallet.Wallet#wallet2",
"to": "resource:org.poc.wallet.Wallet#wallet3",
"amount": 100,
"eventId": "7c180da643f418f4bfb40187ccecef7dddd2d3f4ff952ab16fd913bcccedeac2#0",
"timestamp": "2018-06-05T08:04:38.857Z"
}
]
我已经在我的 ACL 文件中尝试过,但没有触发规则:
rule CustomersSeeHistoryForWalletTransaction {
description: "Customers should be able to see the history of their own transactions only"
participant(p): "org.poc.wallet.Customer"
operation: READ
resource(r): "org.hyperledger.composer.system.HistorianRecord"
condition: (r.eventsEmitted[0].to.owner.getIdentifier() === p.getIdentifier())
action: ALLOW
}
在这里查看答案 -> how to access the 'eventEmitted' field in transaction history of hyperledger fabric (based on using Event in the trade-network
sample network) - and the Event class as described here -> https://github.com/hyperledger/composer/blob/master/packages/composer-common/lib/system/org.hyperledger.composer.system.cto#L144 -
还请注意,目前为 Composer 查询创建了一个问题 - 即能够根据事件定义中的自定义事件查询 Historian,并在历史记录中的 eventsEmitted
数组中具有自定义事件字段以进行搜索 -见 https://github.com/hyperledger/composer/issues/3540
我正在使用 Hyperledger Composer,我想访问历史记录中 'eventsEmitted' 数组中的 "to" 字段:
"eventsEmitted": [
{
"$class": "org.poc.wallet.WalletTransferEvent",
"from": "resource:org.poc.wallet.Wallet#wallet2",
"to": "resource:org.poc.wallet.Wallet#wallet3",
"amount": 100,
"eventId": "7c180da643f418f4bfb40187ccecef7dddd2d3f4ff952ab16fd913bcccedeac2#0",
"timestamp": "2018-06-05T08:04:38.857Z"
}
]
我已经在我的 ACL 文件中尝试过,但没有触发规则:
rule CustomersSeeHistoryForWalletTransaction {
description: "Customers should be able to see the history of their own transactions only"
participant(p): "org.poc.wallet.Customer"
operation: READ
resource(r): "org.hyperledger.composer.system.HistorianRecord"
condition: (r.eventsEmitted[0].to.owner.getIdentifier() === p.getIdentifier())
action: ALLOW
}
在这里查看答案 -> how to access the 'eventEmitted' field in transaction history of hyperledger fabric (based on using Event in the trade-network
sample network) - and the Event class as described here -> https://github.com/hyperledger/composer/blob/master/packages/composer-common/lib/system/org.hyperledger.composer.system.cto#L144 -
还请注意,目前为 Composer 查询创建了一个问题 - 即能够根据事件定义中的自定义事件查询 Historian,并在历史记录中的 eventsEmitted
数组中具有自定义事件字段以进行搜索 -见 https://github.com/hyperledger/composer/issues/3540