Hyperledger fabric [Hyperledger Composer]不允许尝试获取InvalidRelationship上的属性所有者-ACL问题
我在玩Hyperledger Composer时遇到了以下错误Hyperledger fabric [Hyperledger Composer]不允许尝试获取InvalidRelationship上的属性所有者-ACL问题,hyperledger-fabric,blockchain,hyperledger-composer,hyperledger-chaincode,chaincode,Hyperledger Fabric,Blockchain,Hyperledger Composer,Hyperledger Chaincode,Chaincode,我在玩Hyperledger Composer时遇到了以下错误 { "$class": "org.property.registration.purchaseProperty", "propertyListing": "resource:org.property.registration.PropertyListing#PL001" } 错误:不允许尝试获取InvalidRelationship上的属性所有者。由于ID为“Asset:org.property.registratio
{
"$class": "org.property.registration.purchaseProperty",
"propertyListing":
"resource:org.property.registration.PropertyListing#PL001"
}
错误:不允许尝试获取InvalidRelationship上的属性所有者。由于ID为“Asset:org.property.registration.property”的集合中ID为“1003”的对象而创建的InvalidRelationship不存在;[原因=参与者'org.property.registration.User#0001'没有对资源'org.property.registration.property#1003'的'READ'访问权]
我正在尝试访问资产属性,它是另一个资产属性列表的一部分
asset Property identified by PID {
o String PID
o Integer marketPrice
o DateTime regDate
o String propertyType
o String location
o String status default= "Registered"
--> User owner
}
我正在尝试访问PropertyList资产并更改其中的property资产的状态。
(我想从其他用户发布的PropertyList中购买该属性)
我希望,根据错误消息,这似乎是一些权限问题,这是阻止我购买其他用户的财产帖子
// User can see all properties listed for sale
rule UserAccessAllSaleProperties {
description: "Allow Users to access all properties listed for sale"
participant: "org.property.registration.User"
operation: ALL
resource: "org.property.registration.PropertyListing"
action: ALLOW
}
在这里,我想访问属性,它是PropertyList的一部分。
我正试图找到什么短ACL我可以使用。还在努力
欢迎各位提出建议 试试看
rule UserAccessAllSaleProperties {
description: "Allow Users to access all properties listed for sale"
participant: "org.property.registration.**"
operation: READ
resource: "org.property.registration.PropertyListing"
action: ALLOW
}
这将允许所有参与者仅“读取”更适合您的应用程序的PropertyList资产。如果你介绍未来的参与者,这将是有益的。(假设用户被定义为参与者而不是资产)
我还建议将参与者文件和资产文件分开,因为您有一个大型应用程序。
像
并将它们相互导入
所以你的规则是
rule UserAccessAllSaleProperties {
description: "Allow Users to access all properties listed for sale"
participant: "org.property.registration.Participants.**"
operation: READ
resource: "org.property.registration.PropertyListing"
action: ALLOW
}
谢谢你的回复。我已经改变了ACL,它几乎和你提到的一样,并且对我有效。
// User can see all properties listed for sale
rule UserAccessAllSaleProperties {
description: "Allow Users to access all properties listed for sale"
participant: "org.property.registration.User"
operation: ALL
resource: "org.property.registration.PropertyListing"
action: ALLOW
}
rule UserAccessAllSaleProperties {
description: "Allow Users to access all properties listed for sale"
participant: "org.property.registration.**"
operation: READ
resource: "org.property.registration.PropertyListing"
action: ALLOW
}
org.property.registration.Property (-> Will only contain Assets)
org.property.registration.Participants (-> Will only contain Participants)
rule UserAccessAllSaleProperties {
description: "Allow Users to access all properties listed for sale"
participant: "org.property.registration.Participants.**"
operation: READ
resource: "org.property.registration.PropertyListing"
action: ALLOW
}