【问题标题】:A participant using transaction to update/add another participant参与者使用事务更新/添加另一个参与者
【发布时间】:2019-03-05 10:28:45
【问题描述】:

假设我分别创建了两个 Participant type A 和 B,以及一个只能由参与者 type B 或 admin 执行的事务 X。
此外,我添加了一些权限规则,参与者 A 只能由管理员或其他类型 A 的参与者创建/更新。
现在,我在事务 X 中的逻辑需要创建/更新参与者 A。因此,如果我使用参与者 B 注册表 ID 之一执行事务 X,它是否能够创建/更新参与者 A?
如果不能,那么有什么办法吗?

【问题讨论】:

    标签: hyperledger-composer smartcontracts role-based-access-control


    【解决方案1】:

    如果我正确理解了您的要求,那么这些规则应该适用于您想要的核心: (本例使用默认的基本样本网络)

    rule BforX {
     description: "Allow B access to transaction X"
     participant: "org.example.basic.SampleParticipantB"
     operation: READ, CREATE, UPDATE
     resource: "org.example.basic.SampleTransactionX"
     action: ALLOW
    }
    
    rule BforAinX {
     description: "Allow B access to A whilst in X"
     participant: "org.example.basic.SampleParticipantB"
     operation: READ, CREATE, UPDATE
     resource: "org.example.basic.SampleParticipantA"
     transaction: "org.example.basic.SampleTransactionX"
     action: ALLOW
    }
    
    rule NotAforX {
     description: "Deny A access to transaction X"
     participant: "org.example.basic.SampleParticipantA"
     operation: ALL
     resource: "org.example.basic.SampleTransactionX"
     action: DENY
    }
    
    rule AforA {
     description: "Allow A access to Participant_A"
     participant: "org.example.basic.SampleParticipantA"
     operation: READ, CREATE, UPDATE
     resource: "org.example.basic.SampleParticipantA"
     action: ALLOW
    }
    

    【讨论】:

    • 感谢您的示例
    猜你喜欢
    • 1970-01-01
    • 2016-07-08
    • 2015-12-28
    • 2022-08-19
    • 2014-04-30
    • 1970-01-01
    • 2016-09-24
    • 2017-12-27
    • 1970-01-01
    相关资源
    最近更新 更多