关于超级账本结构网络的参与者

时间:2018-08-09 09:40:57

标签: hyperledger-fabric blockchain hyperledger-composer

如果我使用以下命令创建了参与者,则需要澄清网络参与者(作曲者参与者添加-c anitha @ sample-network -d'{“ $ class”:“ test.participant”,“ name”: “ Anitha”,“ id”:“ 1”}'),并使用以下命令发布身份(作曲者身份问题-c anitha @ sample-network -f user.card -u user -a“ resource:test.participant#1 “)现在我的问题是此用户是属于ORG1的网络的参与者,还是不特定于ORG1。我们怎么知道他是permisssion.acl文件中的org1参与者,所以我可以对不同的org参与者拥有单独的访问权限

1 个答案:

答案 0 :(得分:0)

根据您上面提供的信息-仅允许当前参与者更新同一组织(即org1)中其他参与者(在同一班级)的规则将是:

rule myACLrule {
    description: "check which target participants THIS current participant can update"
    participant(p): "test.participantMember"
    operation: ALL
    resource(r): "test.participantMember"
    condition: ( (p.name.lastIndexOf('org1',4) > -1) == (r.name.lastIndexOf('org1',4) > -1) )
    action: ALLOW
}

其中“ 4”是您的组织子字符串的长度,例如。 'org1'等。

ps。 participant已经是模型文件中出于不同目的的保留字,因此,为清楚起见,该示例使用participantMember

pps,如果您使用不同的组织名称-只需使用indexOf()-在Google上搜索大量示例(可以使用其他搜索引擎)。

相关问题