Hyperledger Composer权限.ACL

问题描述 投票:0回答:3

我希望Seller看到他的账号:Seller在他的READ上有Account访问。但是我的规则不起作用。我怎样才能做到这一点?

//Sellers to have read access to Account asset
rule SellerReadAccessAccountsRecord {
description: "Allow seller read access to his Account asset"
participant(p): "org.acme.biznet.Seller"
operation: READ
resource(r): "org.acme.biznet.Account"
condition: (r.owner.getIdentifier() === p.getIdentifier())
action: ALLOW
}
acl hyperledger-fabric hyperledger-composer
3个回答
1
投票

如果你Account模型看起来像:

asset Account identified by accountId { 
o String accountId 
o String currency default="EUR" 
--> Seller owner
o Double balance default=0.0 
}

那么您当前的许可将有效。否则您的许可条件需要改变如下:

condition: (r.ownerId == p.getIdentifier())

0
投票

//卖家具有对账户资产规则的读取权限SellerReadAccessAccountsRecord {描述:“允许卖家对其账户资产的读取权限”参与者(p):“org.acme.biznet.Seller”操作:READ资源(r):“org。 acme.biznet.Seller“condition:(r.getIdentifier()== p.getIdentifier())action:ALLOW}

有关更多信息,请查看here


0
投票

这是我的解决方案:

//卖方拥有对自己的空气污染数据资产的读/写/更新权限

rule SellerAccessAirPollutionDataRecord {
    description: "Allow sellers read/write/update access to own air pollution data assets"
    participant(p): "org.acme.biznet.Seller"
    operation: CREATE, UPDATE, READ
    resource(r): "org.acme.biznet.AirPollutionData"
    condition: (r.owner.getIdentifier() == p.getIdentifier())
    action: ALLOW
}

//卖方可以读取销售的空气污染数据资产

rule SellerReadAccessAirPollutionDataRecord {
    description: "Allow sellers read access to sold air pollution data assets"
    participant(p): "org.acme.biznet.Seller"
    operation: READ
    resource(r): "org.acme.biznet.AirPollutionData"
    condition: (r.owner.getIdentifier() != p.getIdentifier())
    action: ALLOW
}
© www.soinside.com 2019 - 2024. All rights reserved.