Includes function in ACL condition

后端 未结 1 928
半阙折子戏
半阙折子戏 2021-01-15 06:33

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

相关标签:
1条回答
  • 2021-01-15 07:36

    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.

    0 讨论(0)
提交回复
热议问题