Includes function in ACL condition

只愿长相守 提交于 2019-12-01 10:27:58

It's a good question; there's an updated ACL below that I've tested using the online playground.

This is the updated rule:

rule LimitAccess {
   description: "An organisation may updates a medical file which they have permission from"
   participant(h): "nl.epd.blockchain.HealthCareProfessional"
   operation: ALL
   resource(m): "nl.epd.blockchain.MedicalFile"
   condition: (
     m.organisations.some(function (organisation) {
        return organisation.getIdentifier() === h.organisation.getIdentifier();  
        } )
   )
   action: ALLOW
}

The some function is the critical piece here to scan the array of relationships. Also note the use of the getIdentifier() function as well rather than trying to access the identifier directly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!