3
我試圖用以下步驟在Hyperledger Fabric區塊鏈上開發一個非常簡單的示例: INIT:設置一個包含給定資產「A」數量的表,由一個帳戶號碼 INVOKE:目前沒有任何內容 QUERY:如果您擁有該帳戶或者您具有允許您觀看所有帳戶的特定角色,則會打印給定帳戶的資產餘額。Hyperledger:在鏈式代碼中登錄用戶tcert屬性
所以,在我membersrvc.yaml,我添加的成員,和屬性是這樣的:
eca:
affiliations:
banks_and_institutions:
banks:
- bank_a
- bank_b
- bank_c
users:
# Users for usecase1
client1: 1 client1 bank_a
client2: 1 client2 bank_b
client3: 1 client3 bank_c
back_office: 1 back_office bank_c
regulator: 1 regulator bank_c
aca:
# User attributes for usercase1
attribute-entry-1: client1;bank_a;role;client;2015-01-01T00:00:00-03:00;;
attribute-entry-2: client1;bank_a;account;client1;2015-01-01T00:00:00-03:00;;
attribute-entry-3: client2;bank_b;role;client;2015-01-01T00:00:00-03:00;;
attribute-entry-4: client2;bank_b;account;client2;2015-01-01T00:00:00-03:00;;
attribute-entry-5: client3;bank_c;role;client;2015-01-01T00:00:00-03:00;;
attribute-entry-6: client3;bank_c;account;client3;2015-01-01T00:00:00-03:00;;
attribute-entry-7: back_office;bank_c;role;back_office;2015-01-01T00:00:00-03:00;;
attribute-entry-8: back_office;bank_c;account;back_office;2015-01-01T00:00:00-03:00;;
attribute-entry-9: regulator;bank_c;role;regulator;2015-01-01T00:00:00-03:00;;
attribute-entry-10: regulator;bank_c;account;regulator;2015-01-01T00:00:00-03:00;;
address: localhost:7054
server-name: acap
enabled: true
但我的問題是:
我怎樣才能在我的查詢功能,查詢這些信息的鏈碼?
我的意思是,在啓用安全性和命令發佈給定用戶:
peer network login client1 -p client1
peer chaincode query -u client1 -n usecase1 -c '{"Function":"assets", "Args": ["some_username"]}'
能夠獲得客戶端1角色&帳戶,並將我的規則。
謝謝!