我希望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
}
如果你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())
//卖家具有对账户资产规则的读取权限SellerReadAccessAccountsRecord {描述:“允许卖家对其账户资产的读取权限”参与者(p):“org.acme.biznet.Seller”操作:READ资源(r):“org。 acme.biznet.Seller“condition:(r.getIdentifier()== p.getIdentifier())action:ALLOW}
有关更多信息,请查看here
这是我的解决方案:
//卖方拥有对自己的空气污染数据资产的读/写/更新权限
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
}