Hyperledger fabric 访问例外:参与者

Hyperledger fabric 访问例外:参与者,hyperledger-fabric,hyperledger-composer,Hyperledger Fabric,Hyperledger Composer,我正在尝试创建一个由买家、卖家、提供商、发货人等组成的示例区块链应用程序。作为买家,我能够成功创建购买交易,并将交易从创建更新为购买。现在,一旦订单处于购买状态,卖家就可以更改订单以指示提供商完成订单。由于某些原因,卖方无法这样做。我将模型、ACL和异常堆栈跟踪附加到某个人身上,看看这个,确定我所做的是正确的还是错误的。如果您发现任何错误,请提供正确方法的建议。蒂亚 权限.acl rule NetworkAdminUser { description: "Grant business n

我正在尝试创建一个由买家、卖家、提供商、发货人等组成的示例区块链应用程序。作为买家,我能够成功创建购买交易,并将交易从创建更新为购买。现在,一旦订单处于购买状态,卖家就可以更改订单以指示提供商完成订单。由于某些原因,卖方无法这样做。我将模型、ACL和异常堆栈跟踪附加到某个人身上,看看这个,确定我所做的是正确的还是错误的。如果您发现任何错误,请提供正确方法的建议。蒂亚

权限.acl

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
}
/**
* end of V0.14 additions
*/

/**
*
**/
rule BuyerACLCreate {
    description: "Enable Buyers to execute all actions on an Order"
    participant(m): "org.acme.Z2BTestNetwork.Buyer"
    operation: READ, CREATE, UPDATE
    resource(v): "org.acme.Z2BTestNetwork.**"
    transaction(tx): "org.acme.Z2BTestNetwork.CreateOrder"
    condition: (v.buyer.buyerID == m.getIdentifier())
    action: ALLOW
}

/**
*
**/
rule BuyerACLBuy {
    description: "Enable a Buyer to update an Order from Create to Buy"
    participant(m): "org.acme.Z2BTestNetwork.Buyer"
    operation: READ, CREATE, UPDATE
    resource(v): "org.acme.Z2BTestNetwork.**"
    transaction(tx): "org.acme.Z2BTestNetwork.Buy"
    condition: (v.buyer.buyerID == m.getIdentifier())
    action: ALLOW
}

/**
*
**/
rule BuyerACLCancel {
    description: "Enable a Buyer to CANCEL an Order"
    participant(m): "org.acme.Z2BTestNetwork.Buyer"
    operation: READ, CREATE, UPDATE, DELETE
    resource(v): "org.acme.Z2BTestNetwork.**"
    transaction(tx): "org.acme.Z2BTestNetwork.OrderCancel"
    condition: (v.buyer.buyerID == m.getIdentifier())
    action: ALLOW
}

/**
*
**/
rule BuyerACLDispute {
    description: "Enable a Buyer to raise a DISPUTE on an Order"
    participant(m): "org.acme.Z2BTestNetwork.Buyer"
    operation: READ, CREATE, UPDATE
    resource(v): "org.acme.Z2BTestNetwork.**"
    transaction(tx): "org.acme.Z2BTestNetwork.Dispute"
    condition: (v.buyer.buyerID == m.getIdentifier())
    action: ALLOW
}

/**
*
**/
rule BuyerACLResolve {
    description: "Enable a Buyer to RESOLVE a DISPUTEd Order"
    participant(m): "org.acme.Z2BTestNetwork.Buyer"
    operation: READ, CREATE, UPDATE
    resource(v): "org.acme.Z2BTestNetwork.**"
    transaction(tx): "org.acme.Z2BTestNetwork.Resolve"
    condition: (v.buyer.buyerID == m.getIdentifier())
    action: ALLOW
}

/**
*
**/
rule BuyerACLAuthorizePayment {
    description: "Enable a Buyer to AuthorizePayment for an Order"
    participant(m): "org.acme.Z2BTestNetwork.Buyer"
    operation: READ, CREATE, UPDATE
    resource(v): "org.acme.Z2BTestNetwork.**"
    transaction(tx): "org.acme.Z2BTestNetwork.AuthorizePayment"
    condition: (v.buyer.buyerID == m.getIdentifier())
    action: ALLOW
}

/**
*
**/
rule BuyerACL {
    description: "Allow Buyer full access to any order where they are listed as Buyer"
    participant(m): "org.acme.Z2BTestNetwork.Buyer"
    operation: READ, CREATE, UPDATE, DELETE
    resource(v): "org.acme.Z2BTestNetwork.Order"
    condition: (v.buyer.buyerID == m.getIdentifier())
    action: ALLOW
}

/**
*
*/
rule netAccessBuyer {
  description: "Allow Buyers access to the network"
  participant: "org.acme.Z2BTestNetwork.Buyer"
  operation: READ, CREATE, UPDATE, DELETE
  resource: "org.hyperledger.composer.system.**"
  action: ALLOW
}

/**
*
**/
rule SellerOrderFromSupplier {
    description: "Enable a Seller to Submit an Order to a third party for fulfillment"
    participant(m): "org.acme.Z2BTestNetwork.Seller"
    operation: READ, CREATE, UPDATE
    resource(v): "org.acme.Z2BTestNetwork.**"
    transaction(tx): "org.acme.Z2BTestNetwork.OrderFromSupplier"
    condition: (v.seller.sellerID == m.getIdentifier())
    action: ALLOW
}

/**
*
**/
rule SellerRequestPayment {
    description: "Enable a Seller to request payment for a fulfilled order"
    participant(m): "org.acme.Z2BTestNetwork.Seller"
    operation: READ, CREATE, UPDATE
    resource(v): "org.acme.Z2BTestNetwork.**"
    transaction(tx): "org.acme.Z2BTestNetwork.RequestPayment"
    condition: (v.seller.sellerID == m.getIdentifier())
    action: ALLOW
}

/**
*
**/
rule SellerResolve {
    description: "Enable a Seller to resolve a dispute"
    participant(m): "org.acme.Z2BTestNetwork.Seller"
    operation: READ, CREATE, UPDATE
    resource(v): "org.acme.Z2BTestNetwork.**"
    transaction(tx): "org.acme.Z2BTestNetwork.Resolve"
    condition: (v.seller.sellerID == m.getIdentifier())
    action: ALLOW
}

/**
*
**/
rule SellerRefund {
    description: "Enable a Seller to refund payment for a disputed order"
    participant(m): "org.acme.Z2BTestNetwork.Seller"
    operation: READ, CREATE, UPDATE
    resource(v): "org.acme.Z2BTestNetwork.**"
    transaction(tx): "org.acme.Z2BTestNetwork.Refund"
    condition: (v.seller.sellerID == m.getIdentifier())
    action: ALLOW
}

/**
*
**/
rule SellerACL {
    description: "Allow Seller full access to order where they are listed as seller and the order has been Submitted for Purchase"
    participant(m): "org.acme.Z2BTestNetwork.Seller"
    operation: READ, CREATE, UPDATE
    resource(v): "org.acme.Z2BTestNetwork.Order"
    condition: ((v.seller.sellerID == m.getIdentifier()) && (v.bought != ''))
    action: ALLOW
}

/**
*
*/
rule netAccessSeller {
  description: "Allow Sellers access to the network"
  participant: "org.acme.Z2BTestNetwork.Seller"
  operation: READ, CREATE, UPDATE, DELETE
  resource: "org.hyperledger.composer.system.**"
  action: ALLOW
}

/**
*
**/
rule FinanceCoACL {
    description: "Allow FinanceCo full access to all Orders"
    participant: "org.acme.Z2BTestNetwork.FinanceCo"
    operation: ALL
    resource: "org.acme.Z2BTestNetwork.*"
    action: ALLOW
}
模型

异常堆栈跟踪 为AbbykidFriendlyincom1526916622207入站id输入来自供应商的订单:bob@pchardwareinc.com订单号为。卖方为:bob@pchardwareinc.com AbbykidFriendlyincom1526916622207提交交易以更新供应商订单状态失败,文本为:尝试调用业务网络时出错。错误:没有来自任何对等方的有效响应。
来自尝试的对等通信的响应为错误:错误:2未知:执行链码时出错:返回的事务失败:AccessException:Participant'org.acme.Z2BTestNetwork.Seller#bob@pchardwareinc.com“”没有对资源的“创建”访问权限“org.acme.Z2BTestNetwork.OrderFromSupplier#751d9ec9d134be96cef201e49531f73aba55d004550c9b3d89bfc9f5cc225e5”

该错误表明您缺少一条规则-允许这些参与者使用事务类(资源)-建议类似的内容-在规则“节”列表的上方(不确定您的评论是否反映了此添加)


因此,参与者有权执行该事务类型(上面的资源)。

通过拆除现有结构、杀死所有docker容器、重新创建结构并重新部署我的香蕉文件来解决它!
namespace org.acme.Z2BTestNetwork
import composer.base.*
import composer.events.*

participant Buyer identified by buyerID extends Member{
    o String buyerID
}
participant Seller identified by sellerID extends Member{
    o String sellerID
}
participant Shipper identified by shipperID extends Member {
    o String shipperID
}
participant Provider identified by providerID extends Member {
    o String providerID
}
participant FinanceCo identified by financeCoID extends Member {
    o String financeCoID
}

asset Order identified by orderNumber {
    o String orderNumber
    o String[] items
    o String status
    o String dispute
    o String resolve
    o String backorder
    o String refund
    o Integer amount
    o String created
    o String bought
    o String cancelled
    o String ordered
    o String dateBackordered
    o String requestShipment
    o String delivered
    o String delivering
    o String disputeOpened
    o String disputeResolved
    o String paymentRequested
    o String orderRefunded
    o String approved
    o String paid
    --> Provider provider
    --> Shipper shipper
    --> Buyer buyer
    --> Seller seller 
    --> FinanceCo financeCo 

}
  transaction CreateOrder {
    o Integer amount
    --> Order order
    --> Buyer buyer
    --> Seller seller
    --> FinanceCo financeCo
}
  transaction OrderCancel {
    --> Order order
    --> Buyer buyer
    --> Seller seller
}
  transaction Buy {
    --> Order order
    --> Buyer buyer
    --> Seller seller
}
  transaction OrderFromSupplier {
    --> Order order
    --> Provider provider
    --> Seller seller
}
  transaction RequestShipping {
    --> Order order
    --> Shipper shipper
    --> Provider provider
}
  transaction Deliver {
    --> Order order
    --> Shipper shipper
}
  transaction Delivering {
    o String deliveryStatus
    --> Order order
    --> Shipper shipper
}
  transaction BackOrder {
    o String backorder
    --> Order order
    --> Provider provider
}
  transaction Dispute {
    o String dispute
    --> Order order
    --> Buyer buyer
    --> Seller seller
    --> FinanceCo financeCo
}
  transaction Resolve {
    o String resolve
    --> Order order
    --> Buyer buyer
    --> Seller seller
    --> Shipper shipper
    --> Provider provider
    --> FinanceCo financeCo
}
  transaction RequestPayment {
    --> Order order
    --> Seller seller
    --> FinanceCo financeCo
}
  transaction AuthorizePayment {
    --> Order order
    --> Buyer buyer
    --> FinanceCo financeCo
}
  transaction Pay {
    --> Order order
    --> Seller seller
    --> FinanceCo financeCo
}
  transaction Refund {
    o String refund
    --> Order order
    --> Seller seller
    --> FinanceCo financeCo
}
rule netAccessSellerTxnOrderFromSupplier {
description: "Allow Sellers run transaction"
participant: "org.acme.Z2BTestNetwork.Seller"
operation: READ, CREATE
resource: "org.acme.Z2BTestNetwork.OrderFromSupplier"
action: ALLOW
}