I have an asset called MedicalFile which contains a reference to an organization. The participant HealthCareProfessional also belongs to an organization.
Now I\'d li
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.