Hyperledger作曲者对参与者数组的许可 [英] Hyperledger composer Permission for array of Participants
问题描述
我正在Hyperledger作曲器中创建资产,如下所示.我想在Bank []数组中添加参与者(这些银行将仅具有只读访问权限).在Permission.acl文件中,如何为该资产(只读)存在参与者的条件写出检查条件(银行[]).
I am creating an asset in Hyperledger composer as shown below. I want to add participants in Bank[] array (these banks will only have read only access). In Permission.acl file how can I write condition for checking into the array(Bank[]) if the participant exist for this asset(Read only).
资产定义:
asset Details identified by detailsId {
o String detailsId
o String description optional
--> Bank owner
--> Bank[] access optional
o String document
}
推荐答案
如下所示-a)如果不为空,b)如果银行的参与者被授权(通过检查数组),则允许读取访问(如果我没看错的话).
something like below - a) if its not empty and b) if the participant from the bank is authorised (by checking the array) - if so, allow READ access (if I read you correctly).
rule checkParticipant {
description: "check Participant is from allowed Bank"
participant(p): "org.acme.account.BankTeller"
operation: READ
resource(v): "org.acme.account.Details"
condition: ( v.access && v.access.indexOf(p.getIdentifier()) > -1 )
action: ALLOW
}
或条件(如以下问题):
or a condition (something like below) if case is an issue:
condition: ( v.access && v.access.toLowerCase().indexOf(p.getIdentifier().toLowerCase()) > -1 )
这篇关于Hyperledger作曲者对参与者数组的许可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!