非管理员参与者的Hyperledger Composer中的访问控制问题

时间:2019-05-09 11:40:21

标签: hyperledger hyperledger-composer

我遇到了有关Hyperledger作曲者中访问控制的问题。 我已经阅读并使用了Hyperledger Composer v0.19 Hiding Historian in ACL中的说明,但仍然没有成功。 我希望有以下几种情况:

  1. 我们在名为“ org.example.assets”的命名空间中拥有不同类型的资产。代码类似于以下

命名空间org.example.assets

导入org.example。*

 df.to_gbq('db_name.table_name', 
           project_id='xyz', 
           if_exists='append', 
           verbose=False, 
           table_schema=[{'name': '_' + str(col).replace('-','_'), 'type': 'INT64'} 
                         for col in df.columns]
 )

我希望资产所有者能够访问它们,而没有其他参与者。参与者示例只是继承参与者,并放置在org.example命名空间中。

    我不希望每个参与者都看整个历史学家。他/她只能看到他/她自己进行的交易记录

这是我到目前为止拥有的Permissions.acl文件

abstract asset exampleAsset identified by Id 
{
 o String Id
 --> exampleParticipant owner
}

asset myAsset extends exampleAsset
{
 o String title 
 o String description
 o String criteriaUrl 
 o String logoUrl
 --> exampleParticipant issuer
}

我使用管理卡连接到作曲家游乐场,然后创建一个新参与者并为该参与者颁发身份。但是当我尝试使用新创建的卡连接到网络时,出现以下错误

rule Participant_CanAccessOwnAssets {
   description: "owner has full access"
   participant(p): "org.example.exampleParticipant"
   operation: ALL
   resource(r): "org.example.assets.exampleAsset"
   condition: (p.getIdentifier() == r.owner.getIdentifier())
   action: ALLOW
}


rule Participant_CanOnlyReadOwnHistorian {
   description: "each party should be able to read its own record"
   participant(p): "org.example.exampleParticipant"
   operation: READ
   resource(r): "org.hyperledger.composer.system.HistorianRecord"
   condition: (p.getIdentifier() == r.participantInvoking.getIdentifier())
   action: ALLOW
}

rule Participants_DenyAccessToHistorian {
   description: "participants cannot access general historian"
   participant: "org.example.exampleParticipant"
   operation: READ
   resource: "org.hyperledger.composer.system.HistorianRecord"
   action: DENY
}

rule Participant_CanReadNetwork {
   description: "participants can read (connect to) the business network"
   participant: "org.example.exampleParticipant"
   operation: READ
   resource: "org.hyperledger.composer.system.Network"
   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
 }

我应该怎么做才能解决这个问题? 我猜想这条规则与我正在使用的继承有关,可以概括为从抽象exampleAsset继承的任何资产都有所有者,但这是否引起我的问​​题?

Error: transaction returned with failure: AccessException: Participant 'org.pledger.PledgerParticipant#neo' does not have 'READ' access to resource 'org.hyperledger.composer.system.AssetRegistry#org.hyperledger.composer.system.HistorianRecord'

1 个答案:

答案 0 :(得分:1)

在进入主题之前,仅对ACL文件发表两条评论:

  1. 第13行,有一个错字(“参加者”)
  2. 在第5行,它应该是“ org.example.exampleAsset”

关于继承是否是这里的问题,我不确定。但是,例如在sample network "letters of credit"中,我们还看到了一个添加到抽象类中的关系。这对您的访问控制规则文件意味着什么呢?

您是否尝试过在子类上添加关系以查看是否可行?

相关问题