如果我正在使用数组,如何在 ACL 文件的规则中写入条件?

How can I write a condition in a rule of the ACL file, if I'm working with arrays?

我有这个规则:

rule Viewer {
  description: "Allow the viewer read access to his assigned assets"
  participant(v): "org.biz.app.Viewer"
  operation: READ
  resource(d): "org.biz.app.Activo"
  condition: (v.getIdentifier() === d.viewers.getIdentifier())
  action: ALLOW
}

并在模型文件中:

asset Activo identified by acitvoId {
  o String activoId
  o String activoName
  o Integer version
  o DateTime startDate
  o DateTime endDate
  --> Author owner
  --> Viewer[] viewers optional
}

我想要的规则是查看者只能读取分配给他的资产。 该:

v.getIdentifier();

returns 查看者 ID,我想将它与资产中的查看者数组进行比较:

--> Viewer[] viewers optional

如果 viewerid 在数组中,则查看者具有读取权限。我该如何编写该规则?

pii 网络包含引用数组的 ACL 规则。例如。在此处调用 indexOf

https://github.com/hyperledger/composer-sample-networks/blob/master/packages/pii-network/permissions.acl#L38