You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package hackathon_v2024
import rego.v1
default allow :=false
allow if {
# this policy is applicable to the scope
input.introspectionResult.scope[0] =="hackathon_v2024.10"# the requesting org is part of the care team
care_team_members[requestor_ura]
# the operation on the requested resource is alowed
operation_allowed
}
resource_rights := {"Patient": ["read"]}
operation_allowed if {
http_operations := {
"GET": "read",
"POST": "write",
"PUT": "update",
"DELETE": "delete",
}
operation := http_operations[input.request.http.method]
some allowed_operation in resource_rights[resource_name]
allowed_operation == operation
}
path := input.request.http.path
bsn := regex.find_all_string_submatch_n(`^.*identifier=http://fhir.nl/fhir/NamingSystem/bsn\|(\d+)$`, path, -1)[0][1]
resource_name := regex.find_all_string_submatch_n(`\/([A-Z]\w+)\??`, path, 1)[0][1]
requestor_ura := input.introspectionResult.input_descriptor_constraint_id_map[uracredential_uraNumber]
scope := input.introspectionResult.scope[0]
care_team_members contains identifier if {
# select the care team for the patient with bsn
care_team := [team |
input.resources[_].resourceType =="CareTeam"
input.resources[_].subject.identifier.value == bsn
team := input.resources[_].participant[j]
]
# select the members with an ura as identifier (all organisations) some member in care_team
identifier := member.member.identifier.value
member.member.identifier.system =="$ura"
}
Rego policy moet voortkomen uit de gemaakte autorisatie afspraken #7
Maakt gebruik van consent en het care team.
Todo:
Overgenomen uit Hackathon documentatie:
Policy (check it out in the playground:
Input:
The text was updated successfully, but these errors were encountered: