我有我的query.qry
文件中定义以下查询:
query selectItemsByOwner {
description: "Select all items based on their owner uid"
statement:
SELECT org.example.auctchain.Item
WHERE (owner.uid == _$uid)
}
我的ACL许可文件具有以下规则:
rule Auctioneer {
description: "Allow the auctioneer full access"
participant: "org.example.auctchain.Auctioneer"
operation: ALL
resource: "org.example.auctchain.*"
action: ALLOW
}
rule Member {
description: "Allow the member read access"
participant: "org.example.auctchain.Member"
operation: READ
resource: "org.example.auctchain.*"
action: ALLOW
}
rule VehicleOwner {
description: "Allow the owner of a vehicle total access"
participant(m): "org.example.auctchain.Member"
operation: ALL
resource(v): "org.example.auctchain.Item"
condition: (v.owner.getIdentifier() == m.getIdentifier())
action: ALLOW
}
rule VehicleListingOwner {
description: "Allow the owner of a vehicle total access to their
vehicle listing"
participant(m): "org.example.auctchain.Member"
operation: ALL
resource(v): "org.example.auctchain.ItemListing"
condition: (v.vehicle.owner.getIdentifier() == m.getIdentifier())
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
}
rule NetworkAdminUser {
description: "Grant business network administrators full access to
user resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "**"
action: ALLOW
}
rule NetworkAdminSystem {
description: "Grant business network administrators full access to
system resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
而我的CTO文件定义如下所涉及的资产和参与者:
asset Item identified by itemId {
o String itemId
o String name
o ItemType type
--> Member owner
}
abstract participant User identified by uid {
o String uid
o String email
o String firstName
o String lastName
o String phoneNumber
}
participant Member extends User {
o Double balance
}
我更新了我的package.json
版本并创建了BNA文件,然后安装它在我的网络上,也做了升级,一切都很好。问题是当我从任我角应用程序中执行此查询,或从作曲REST API资源管理器中,都返回一个空数组。有没有人有这个问题?我似乎无法找到修复,它的真正困扰我,因为我真的需要我的应用程序执行查询。
首先,文件名是queries.qry
。
按我的了解,目前它不是由Hyperledger Composer
支持。
你可以在这里做一两件事,修改查询,如下:
query selectItemsByOwner {
description: "Select all items based on their owner uid"
statement:
SELECT org.dd2.Item
WHERE (owner == _$owner_res)
}
当你执行查询,充分的资源字符串作为输入,如下图所示:
resource:org.dd2.Member#m1