Enums 如何在Hyperledger Composer的ACL文件中设置规则以根据枚举进行验证?

Enums 如何在Hyperledger Composer的ACL文件中设置规则以根据枚举进行验证?,enums,blockchain,hyperledger-fabric,hyperledger,hyperledger-composer,Enums,Blockchain,Hyperledger Fabric,Hyperledger,Hyperledger Composer,我的模型文件的一小部分是- participant Employee identified by empID { o String empID o EmployeeCategory category } enum EmployeeCategory{ o Internal o External } asset CompanyAsset identified by assetID{ o String assetID --> Employee owner

我的模型文件的一小部分是-

participant Employee identified by empID {
  o String empID
  o EmployeeCategory category
}

enum EmployeeCategory{ 
  o Internal 
  o External 
}

asset CompanyAsset identified by assetID{
  o String assetID  
  -->  Employee owner
  o String status 
}

transaction AssignStatus{
--> CompanyAsset assetObject 
}
现在,我想在acl文件中定义一个规则,只有当登录的参与者employeeCategory为“内部”时,才允许创建/更新事务状态


我可以使用empID字段,但不能使用enum,这正是我想要的

使用您的模型和我自己的名称空间我有两个ACL规则,我认为可以解决您的问题:

   rule InternalsOnly {
description: "Allow Internals to submit AssignStatus txn type"
participant(p): "org.acme.trading.Employee"
operation: ALL
resource(v): "org.acme.trading.AssignStatus"
  condition: ( p.category == "Internal" )
action: ALLOW   
}

   rule PreventTransaction {
description: "prevent others executing transactions"
participant: "org.acme.trading.Employee"
operation: ALL
resource: "org.acme.trading.AssignStatus"
action: DENY
}

谢谢。成功了。第二条规则没有必要。。我使用单引号而不是双引号来指定类别,因此没有在我的机器上工作。